PHP SDK for v2
Switch branches/tags
Nothing to show
Clone or download
apoorvakatta Merge pull request #1 from apoorvakatta/master
Update README.md and Source Code
Latest commit 0911072 Aug 22, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vendor
README.md
VERSION
composer.json
passkit-v2-sdk.php

README.md

#PassKit SDK for PHP

PassKit Logo

##Description

###    The PassKit SDK enables user to efficiently connect to the PassKit API. To use this SDK, you will need an account with PassKit.

##0. Prerequisites

###    Import passkitSDK

include_once "path/to/passkit-v2-sdk.php";

##1. PassKit

###    Create PassKit

$pk = new PassKit("apiKey","apiSecret");

##2. Certificate

###    Generate CSR         returns the certificate.

$result = $pk.GenerateCSR();

###    Upload Certificate         returns the Certificate ID (generated by PassKit).

$data = array('name' => 'MyCertificate','description' => 'MyCertificateDiscription');
$result = $pk->UploadCertificate($data, 'path/to/certificate.cer');

###    Retrieve Certificate Information         returns the certificate information.

$result = $pk.GetCertificateDetails('MyCertificateId');

###    Retrieve All Certificates Information         returns an array of certificate information.

$result = $pk.ListCertificates();

##3. Campaign

###    Create Campaign         returns the name of the created campaign.

$data = array('name' => 'MyCampaign','passbookCertId' => 'MyPassbookCertId','startDate' => '2016-01-01T00:00:00Z');
// refer to `https://dev.passkit.net/#create-a-campaign` for a complete attribute list.
$result = $pk->CreateCampaign($data);

###    Retrieve Campaign         returns the details of the retrieved campaign.

$result = $pk->GetCampaign('MyCampaign');

###    Retrieve All Campaigns         returns the details of all retrieved campaigns.

$result = $pk->ListCampaigns();

###    Update Campaign         returns the name of the updated campaign.

$data = array('displayName' => 'MyCampaignDisplayName');
// refer to `https://dev.passkit.net/#update-a-campaign` for a complete attribute list.
$result = $pk->UpdateCampaign('MyCampaign',$data);

##4. Template

###    Create Template         returns the name of the created template.

$data_passbook = array('type' => 'storeCard','desc' => 'Description of the template');
$data = array('name' => 'MyTemplate','campaignName' => 'MyCampaign','language' => 'en','startDate' => '2016-01-01T00:00:00Z', 'passbook' => $data_passbook);
$image_files = array('passbook-IconFile' => 'path/to/image.png');
// refer to `https://dev.passkit.net/#create-a-template` for a complete attribute list.
$result = $pk->CreateTemplate($data,$image_files);

###    Retrieve Template         returns the details of the retrieved template.

$result = $pk->GetTemplate('MyTemplate');

###    Retrieve All Templates         returns the details of all retrieved templates.

$result = $pk->ListTemplatesByCampaign('MyCampaign');

###    Update Template         returns the name of the updated template.

$data = array('language' => 'de');
// refer to `https://dev.passkit.net/#update-a-template` for a complete attribute list.
$result = $pk->UpdateTemplateData('MyTemplate',$data);

###    Update Template with images         returns the name of the updated template.

$data = array('language' => 'en');
$update_image_list = array('passbook-LogoFile' => 'path/to/image.png');
$delete_image_list = array('passbook-StripFile');
// refer to `https://dev.passkit.net/#update-a-template-with-images` for a complete attribute list.
$result = $pk->UpdateTemplateDataImages('TestTemplate_1',$data,$update_image_list,$delete_image_list);
// Note: Set arguments to null if they are not required to update. 

###    Push Update         returns the name of the pushed updated template.

$result = $pk->PushTemplateUpdate('MyTemplate');

##5. Pass

###    Create Pass         returns the id of the created pass.

$data = array('templateName' => 'MyTemplate');
// refer to `https://dev.passkit.net/#create-a-pass` for a complete attribute list.
$result = $pk->CreatePass($data);

###    Retrieve Pass         returns the details of the retrieved pass.

$result = $pk->GetPassById('PassId');

###    Retrieve Pass with userDefinedId         returns the details of the retrieved pass.

$result = $pk->GetPassByUserDefinedId('UserDefinedID','MyCampaign');

###    Update Pass         returns the id of the updated pass.

$data = array('recoveryEmail' => 'apoorva@passkit.com');
// refer to `https://dev.passkit.net/#update-a-pass` for a complete attribute list.
$result = $pk->UpdatePassById('PassId',$data);

###    Update Pass with userDefinedId         returns the id of the updated pass.

$data = array('recoveryEmail' => 'apoorva@passkit.com');
// refer to `https://dev.passkit.net/#updating-a-pass-with-a-user-defined-id` for a complete attribute list.
$result = $pk->UpdatePassByUserDefinedId('UserDefinedID','MyCampaign',$data);

###    Create Pass Batch         returns the ids of the created passes.

$data = array('passes' => array(array('templateName' => 'MyTemplate'),array('templateName' => 'MyTemplate')));
// refer to `https://dev.passkit.net/#batch-create-passes` for a complete attribute list.
$result = $pk->CreatePassBatch($data);

###    Update Pass Batch         returns the ids of the updated passes.

$data = array('passes' => array(array('passId' => 'PassId','recoveryEmail' => 'apoorvakatta@gmail.com'),array('passId' => 'PassId','recoveryEmail' => 'apoorvakatta@gmail.com')));
// refer to `https://dev.passkit.net/#batch-update-passes` for a complete attribute list.
$result = $pk->UpdatePassBatch($data);