m openmage

OpenMage LTS Developer Documentation

Account Create

Edit this page on GitHub

Module: GiftCard API

Resource: giftcard_account

Method:

Allows you to create a new gift card account.

Arguments:

Type Name Description
string sessionId Session ID
array giftcardAccountData Array of giftcardAccountCreateGiftcardAccountData
array notificationData Array of giftcardAccountCreateNotificationData (optional)

Return:

Type Description
string ID of the created gift card account

The giftcardAccountCreateGiftcardAccountData content is as follows:

Type Name Description
string status
Gift card status: available, used, redeemed, expired
string
date_expires
Gift card expiration date in the YYYY-MM-DD format
string
website_id
Gift card website ID
string
balance
Initial gift card balance
string
state
State: active or not active
string
is_redeemable
Defines whether the gift card is redeemable

The giftcardAccountCreateNotificationData content is as follows:

Type Name Description
string recipient_name
Recipient name
string recipient_email
Recipient email address
string recipient_store
Recipient store

Faults:

Fault Code Fault Message
105 Provided gift card account data is invalid.
104 Provided email notification data is invalid

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$giftcardToCreate = array(
    "status" => 'available',
    "is_redeemable" => 1,
    "balance" => 200,
    "website_id" => 2,
    "date_expires" => null
);

$giftcardId = $proxy->call(
    $sessionId,
    "giftcard_account.create",
    array(
         $giftcardToCreate
    )
);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login('apiUser', 'apiKey'); 
 
$result = $proxy->giftcardAccountCreate($sessionId, array(
'status' => 'available', 
'date_expires' => null, 
'website_id' => '2', 
'balance' => '200', 
'state' => '1', 
'is_redeemable' => '1'), 
array(
'recipient_name' => 'name', 
'recipient_email' => 'email', 
'recipient_store' => null)
);   

var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->giftcardAccountCreate((object)array('sessionId' => $sessionId->result, 'giftcardAccountData' => array(
'status' => 'available', 
'date_expires' => null, 
'website_id' => '2', 
'balance' => '200', 
'state' => '1', 
'is_redeemable' => '1'), 
'notificationData' => array(
'recipient_name' => 'name', 
'recipient_email' => 'email', 
'recipient_store' => null)
));   

var_dump($result->result);