Processing an Apple Pay Sale with
Cybersource
Decryption

This section uses a code example to show how to process an Apple Pay sale transaction with the
Cybersource
decryption
implementation of Apple Pay. A sale bundles an authorization and capture in a single transaction. Request the authorization and capture at the same time. The authorization and capture amounts must be the same.
The REST API message for a sale request requires the same fields as the message for an authorization request, but with the addition of the
processingInformation.capture
field set to
true
.
IMPORTANT
In the example, a
Visa card
transaction is processed with
Visa Platform Connect
. If you want to replicate this example for a
different card or processor
, you will need to change some of the API fields in the request message.
For information about supported cards, see Card Types Supported on Visa Platform Connect with Apple Pay.
For general information about sale transactions, see the "Standard Payments Processing" section of the
Payments Developer Guide
.

Fields Specific to This Use Case

These
REST API
request fields and values are specific to this use case:
  • orderInformation.currency
  • orderInformation.totalAmount
  • paymentInformation.fluidData.description
  • paymentInformation.fluidData.encoding
  • paymentInformation.fluidData.value
  • processingInformation.capture
  • processingInformation.paymentSolution

Basic Steps

Follow these steps to request the authorization and capture in a single transaction:
  1. Create the message with the required API fields.
  2. Send the message to one of these endpoints:
    • Production:
      POST
      https://api.cybersource.com
      /pts/v2/payments
    • Test:
      POST
      https://apitest.cybersource.com
      /pts/v2/payments
  3. Verify the response messages to make sure that the request was successful. A 200-level HTTP response code indicates success.

Required Fields for Processing a Sale with
Cybersource
Decryption

As a best practice, include these
REST API
fields in your request for a combined authorization and capture (sale) transaction with the
Cybersource
decryption implementation of Apple Pay.
Depending on your processor, your geographic location, and whether the relaxed address verification system (RAVS) is enabled for your account, some of these fields might not be required. It is your responsibility to determine whether an API field can be omitted from the transaction you are requesting.
Format of the encrypted payment data.
Set the value to
RklEPUNPTU1PTi5BUFBMRS5JTkFQUC5QQVlNRU5U
for Apple Pay.
Encoding method used to encrypt the payment data.
Set the value to
Base64
for Apple Pay.
For card-present transactions: set the value to the encrypted payment data.
Set the value to
true
for a sale transaction (to include a capture with the authorization).
Type of transaction. Some payment card companies use this information when determining discount rates. Possible values:
  • aesk
    :   American Express SafeKey authentication.
  • dipb
    :   Discover card type.
  • internet
    :   Default value for authorizations. E-commerce order placed from a website.
  • js
    :   JCB J/Secure authentication.
  • spa
    :   Mastercard Identity Check authentication.
  • 111
    :   Visa Secure authentication
Set the value to
001
to identify Apple Pay as the digital payment solution.

REST Example: Processing a Sale with
Cybersource
Decryption

Example Request
{ "clientReferenceInformation": { "code": "TC_1231223" }, "processingInformation": { "commerceIndicator": "internet", "paymentSolution": "001", "capture": true }, "orderInformation": { "amountDetails": { "totalAmount": "10", "currency": "USD" }, "billTo": { "firstName": "John", "lastName": "Doe", "address1": "901 Metro Center Blvd", "locality": "Foster City", "administrativeArea": "CA", "postalCode": "94404", "country": "US", "email": "test@cybs.com" } }, "paymentInformation": { "fluidData": { "value": "eyJkYXRhIjoiXC9NK2VQQ0JlMmtod1pMQkFzRWhneHFqYXF2MmtZNDJSNnd1VDdnT3JlelBwRE9hR2dmc1AzZUNHZUplSjFSc3JpSERGSnJIK0FJVHp6RFdjVXNHUlNuSER3QlBcL2JHakU0dUhYcTFDOXFjWDBLWmYzaTFZNkV2b1wvaXExOFhkcG5obTI1U2kwSGpkWUJGRmVBUmZlVENpMEtDSGtRN04wZTAyeElRbm84Qmt1TVwvSUQ5bHdoNXBFVnVYM08ybjc4bHVyU0tlRmpXVHMyWG9Pc1pmWXBpbFQ4ZFFtK2RaYmh6VHgyZ2hMXC9FcFBReUVvdW5QTFZjTlwvaTR0blFnakxWRWJiNUFDNHJ4ZjBwK2M0VGtYSzcycGZGY05NSnlxd0RlQWZ2cHB6cnFQZVdoaWlpdzUwTmljT3duR29tcXA0bWU2anV4S2N5ZFh3cGpJR3BhQlBuXC9NY3o2d2ZDSFAzMWY1NHdkRmZ4bEZadjl5XC85aGw5YlY1d08yN2R5bFwvYUVxN2FYbU5JZHBQNTFsOXlSQlUzNDNYcjR3XC9MSXN2ZmZTTE91WDlsRU5QUGtocE1LUXo4VWpYNG0xXC9xazdcL256aGFSekFaZGh6VGZsNkZ3PT0iLCJ2ZXJzaW9uIjoiRUNfdjEiLCJoZWFkZXIi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VFBdUFHTUFid0J0QWhCY2wrUGYzK1U0cGsxM25WRDlud1FRTUFrR0JTc09Bd0lhQlFBd0RRWUpLb1pJaHZjTkFRRUJCUUFFZ1lDZ2RvN2lrTzdERTNCXC9pY0lycmRjc1ZIanJyQmNPdXNndXhlcGs1QW41ZEExV01rajBlVjRsMVM0RnR5NktwdlR0T0xcL3VSdDhuTHZpVnR0TVVSZHBYTjNWXC9NVmZnVkxlXC9YUm5cLzRzbUJnMVgweE5OTXlTZXBQalVxV1ZkWFg1K0RWYnp2U0ZKSVJGdmt1MHJPaGg3REZmODVpbXNkaGRZRUhCaUg0TzdpK1E9PSJ9", "descriptor": "RklEPUNPTU1PTi5BUFBMRS5JTkFQUC5QQVlNRU5U", "encoding": "Base64" } } }
Response to a Successful Request
{ "_links": { "void": { "method": "POST", "href": "/pts/v2/payments/7321435201936237603954/voids" }, "self": { "method": "GET", "href": "/pts/v2/payments/7321435201936237603954" } }, "clientReferenceInformation": { "code": "TC_1231223" }, "consumerAuthenticationInformation": { "token": "Axj//wSTjOVS/YjpxSxyABsQ3YtGzZwxaJ78Z8Gm0Ap78Z8Gm1pAr6EOWGTSTL0YriJFQwJycZyqX7EdOKWOQAAA5QsX" }, "id": "7321435201936237603954", "issuerInformation": { "responseRaw": "0110322000000E1000020000000000000010001120225841146199444A344C4E335047335157323833313030303030000159008000223134573031363135303730333830323039344730363400103232415050524F56414C00065649435243200034544B54523031313132313231323132313231544C3030323636504E30303431313131" }, "orderInformation": { "amountDetails": { "totalAmount": "10.00", "authorizedAmount": "10.00", "currency": "USD" } }, "paymentAccountInformation": { "card": { "type": "001" } }, "paymentInformation": { "tokenizedCard": { "expirationYear": "2025", "requestorId": "12121212121", "prefix": "411111", "assuranceLevel": "66", "expirationMonth": "07", "suffix": "1111", "type": "001" }, "card": { "suffix": "1111", "type": "001" } }, "pointOfSaleInformation": { "terminalId": "02495701" }, "processingInformation": { "paymentSolution": "001" }, "processorInformation": { "merchantNumber": "000372839590885", "approvalCode": "831000", "networkTransactionId": "016150703802094", "transactionId": "016150703802094", "responseCode": "00", "avs": { "code": "Y", "codeRaw": "Y" } }, "reconciliationId": "71466814", "riskInformation": { "earlyVelocity": { "counts": [ { "count": "1", "informationCode": "MVEL-R1" } ] } }, "status": "AUTHORIZED", "submitTimeUtc": "2024-11-20T22:58:41Z" }