Apple Pay Payouts
The Payout request allows credits to be made to a Customer’s Apple Pay account without referencing an original transaction.
When using Your Payment Page
There are various stages to performing an Apple Pay payout which need to be completed in your JavaScript code as documented by Apple. Once you have checked Apple Pay is available, created an Apple Pay session and validated the merchant you can proceed to making the payout. Once the payout has been authorised Apple will provide the payment token. It will be provided in the Apple SDK session.onpaymentauthorized event. This is the token that needs to be put in the payout request to Access PaySuite. To see this in the example below please look at the paymentMethod key.
session.onpaymentauthorized = function( event ) {
var token = event.payment.token;
// The function authorise(token) will make an ajax call to the site server, which will in turn call
//the Access PaySuite service /acceptor/rest/transactions/{instId}/payment
authorise(token).done( ( response ) => {
// determine success by response from merchant server. In this example the response is outcome.status
//from the Access PaySuite api response returned to your server
var success = "SUCCESS" === response;
var authorizationResult = {
status: ( success ? ApplePaySession.STATUS_SUCCESS : ApplePaySession.STATUS_FAILURE ),
errors: []
};
session.completePayment( authorizationResult ); // hides the Apple Pay sheet
if ( success ) {
showConfirmation( response );
} else {
showDecline( data );
}
} );
};API examples
Processing a Payout
POST /acceptor/rest/transactions/{instId}/payout{
"transaction": {
"currency": "GBP",
"amount": 1000.0,
"description": "Sample Transaction",
"merchantRef": "mer_txn_1234556",
"commerceType": "ECOM",
"channel": "WEB"
},
"paymentMethod": {
"applepay": {
"paymentData" : {
"version" : "EC_v1",
"data" : "3+f4oOTwPa6f1UZ6tG...CE=",
"signature" : "MIAGCSqGSIb3DQ...AAAA==",
"header": {
"applicationData" : "DYkwEK...Yu==",
"ephemeralPublicKey" : "MFkwEK...Md==",
"publicKeyHash" : "l0CnXdMv...D1I=",
"transactionId" : "32b...4f3"
}
},
"paymentMethod" : {
"displayName" : "Visa 1234",
"network" : "Visa",
"type" : "debit"
},
"transactionIdentifier" : "32b...4f3"
}
}
}curl -X POST "{targetEnvironmentPath}/acceptor/rest/transactions/{instId}/payout" \
-u "{apiUser}:{apiPassword}" \
-H "Content-Type: application/json" \
-d '{
"transaction": {
"currency": "GBP",
"amount": 1000.0,
"description": "Sample Transaction",
"merchantRef": "mer_txn_1234556",
"commerceType": "ECOM",
"channel": "WEB"
},
"paymentMethod": {
"applepay": {
"paymentData" : {
"version" : "EC_v1",
"data" : "3+f4oOTwPa6f1UZ6tG...CE=",
"signature" : "MIAGCSqGSIb3DQ...AAAA==",
"header": {
"applicationData" : "DYkwEK...Yu==",
"ephemeralPublicKey" : "MFkwEK...Md==",
"publicKeyHash" : "l0CnXdMv...D1I=",
"transactionId" : "32b...4f3"
}
},
"paymentMethod" : {
"displayName" : "Visa 1234",
"network" : "Visa",
"type" : "debit"
},
"transactionIdentifier" : "32b...4f3"
}
}
}'HTTP/1.1 201
{
"processing": {
"authResponse": {
"statusCode": "00",
"message": "ACQUIRER OK",
"authCode": "100000",
"gatewayReference": "5896345970448890-PASS",
"gatewaySettlement": "2014-10-29",
"gatewayCode": "0900.000.000",
"gatewayMessage": "Transaction succeeded",
"avsAddressCheck": "FULL_MATCH",
"avsPostcodeCheck": "FULL_MATCH",
"status": "AUTHORISED"
},
"route": "PAYON"
},
"paymentMethod": {
"applepay": {
"cardType": "VISA_DEBIT",
"cardUsageType": "DEBIT",
"cardScheme": "VISA"
},
"billingAddress": {
"line1": "1 Some Street",
"city": "Metropolis",
"postcode": "AA1 1AA",
"country": "United Kingdom",
"countryCode": "GBR"
},
"paymentClass": "CARD"
},
"transaction": {
"transactionId": "13501566687",
"merchantRef": "mer_txn_1234556",
"status": "SUCCESS",
"type": "PAYMENT",
"amount": 1000,
"consumerSpend": 1000,
"currency": "GBP",
"transactionTime": "2014-01-06T12:25:30.902Z",
"receivedTime": "2014-01-06T12:25:30.902Z",
"channel": "WEB",
"customerInitiated": true,
"stage": "COMPLETE"
},
"outcome": {
"status": "SUCCESS",
"reasonCode": "S100",
"reasonMessage": "Authorised"
}
}When using the PaySuite Payment Page
Create a hosted session for the payout, then send your customer to the redirectUrl we return.
PaySuite Payment Page examples
Submit a payout
POST /hosted/rest/sessions/{instId}/payouts{
"session": {
"returnUrl": {
"url": "http://www.example.com/transactionResult?MERCHANTREF=761585761585"
}
},
"transaction": {
"merchantReference": "761585761585",
"money": {
"amount": {
"fixed": 100
},
"currency": "GBP"
}
},
"customer": {
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
}
}curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/payouts" \
-u "{apiUser}:{apiPassword}" \
-H "Content-Type: application/json" \
-d '{
"session": {
"returnUrl": {
"url": "http://www.example.com/transactionResult?MERCHANTREF=761585761585"
}
},
"transaction": {
"merchantReference": "761585761585",
"money": {
"amount": {
"fixed": 100
},
"currency": "GBP"
}
},
"customer": {
"identity": {
"merchantCustomerId": "1111111111111"
},
"details": {
"name": "given1 Family1",
"address": {
"line1": "matched",
"line2": "initialCustomer1AddresssLine2",
"city": "initalCustomer1City",
"region": "initalCustomer1Region",
"postcode": "AVS111",
"countryCode": "GBR"
},
"telephone": "0044111111111",
"emailAddress": "[email protected]",
"ipAddress": "1.1.1.1",
"defaultCurrency": "GBP"
}
}
}'HTTP/1.1 201
{
"sessionId": "38694ada-b151-483e-a325-33df7b46c7be",
"redirectUrl": "https://secure.mite.pay360.com/hosted/54ed74fb-2bca-47b1-a831-7d8851f5c31f/begin/38694ada-b151-483e-a325-33df7b46c7be",
"status": "SUCCESS"
}