-
Create / prepare your cart
a. Ensure your cart locale is set
NOTE: : If the cart has multiple shipping methods, the shipping address of the first available shipping method applied to the cart will be used to process the payment
-
Create a Commercetools payment (https://docs.commercetools.com/api/projects/payments) and populate the following
Property Value Required Notes customer Reference to Commercetools customer See notes Required for non-guest checkout. If using MyPayments API this will automatically be set to the logged in customer. One of customer or anonymousId must be populated anonymousId Id for tracking guest checkout See notes Required for guest checkout. If using MyPayments API this will automatically be set. One of customer or anonymousId must be populated paymentMethodInfo.paymentInterface Cybersource Yes paymentMethodInfo.method googlePay Yes amountPlanned Amount to be processed Yes Should match cart gross total, unless split payments are being used custom.type.key isv_payment_data Yes custom.fields.isv_token Google Pay payment data Yes Obtain the base64 encoded value of 'token' field from Google Pay paymentData custom.fields.isv_deviceFingerprintId Customer device fingerprint Id Yes Refer Device Fingerprinting to generate this value custom.fields.isv_customerIpAddress Customer IP address Yes Populated from client-side libraries custom.fields.isv_saleEnabled false Yes Set the value to true if sale is enabled custom.fields.isv_walletType Wallet type No This value is required if walletType is to be passed in authorization. Refer Cybersource Processing a Payment for more information about the wallet type value to be passed. It is supported only for ApplePay, ClicktoPay and GooglePay payment methods custom.fields.isv_merchantId Merchant Id used for the transaction No Required when you want to support Multi-Mid functionality. Populate this field with the value of merchant Id in which the transaction should happen. When this field is empty, default mid configuration will be considered for the transaction. The same mid will be used for the follow-on transactions. custom.fields.isv_shippingMethod Shipping method for the order No Possible values: -
lowcost
: Lowest-cost service sameday
: Courier or same-day serviceoneday
: Next-day or overnight servicetwoday
: Two-day servicethreeday
: Three-day service.-
pickup
: Store pick-up -
other
: Other shipping method -
none
: No shipping method because product is a service or subscription
-
-
Add the payment to the cart
-
Add a transaction to the payment
If only Authorization is required, populate the following fields to the payment
Property Value Notes type Authorization state Initial amount Amount to be processed Should match amountPlanned on payment If Sale is enabled, populate the following fields to the payment
Property Value Notes type Charge state Initial amount Amount to be processed Should match amountPlanned on payment -
Verify the payment state and convey the payment result to the customer
a. If the transaction is successful, transaction state will be updated to Success, display the order confirmation page
b. If the state of transaction is updated to Pending which is due to Fraud Check, display the order confirmation page
c. If the state of transaction is updated to Failure, display the error page and See Overview#Errorhandling for handling errors or failures