Transaction with Payment Handle
Once you have received the single-use payment handle, you can use it to make a payment using the Payments API.
If your transactions are in multiple currencies you need to consider how you will handle the multiple merchant accounts involved and select the correct one to use when taking payment.
The single-use handle is actually called token when created by the SDKs and paymentToken when created by the Payment API. Also called paymentToken when used with Payments API in a Payment; Original Credit; Standalone Credit; Verifications;
The payment endpoint uses the server-to-server API key. Do not use the Payments API from the client's web browser as this will expose this key.
Payment
See process payment
Call the following endpoint from your server to take payment: POST
POST /paymenthub/v1/payments
curl -X POST https://api.test.paysafe.com/paymenthub/v1/payments \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"amount": 1407,
"currencyCode": "USD",
"dupCheck": false,
"settleWithAuth": true,
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"description": "Demo Paysafe Js"
} '
Prior to trying the example, you should:
- Replace the API key user name and password (after the -u) with the Test API key you have received from Paysafe.
- Substitute the paymentToken with the Test card token you obtained from Paysafe.js.
If your account has AVS (address verification system) enabled, you must include a billing address in the authorization call using the billingDetails object. The billing address is the address of the card represented by the payment token. Note that Developer Center test accounts have AVS enabled.
Payment Response Example
{
"id": "3f7992f8-f550-42a7-bc10-79728a43d3c6",
"paymentType": "CARD",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"currencyCode": "USD",
"settleWithAuth": false,
"txnTime": "2022-01-14T13:17:03Z",
"billingDetails": {
"street": "Oak Fields 6",
"city": "ca",
"zip": "90210",
"state": "CA",
"country": "US"
},
"status": "COMPLETED",
"amount": 1407,
"preAuth": false,
"description": "Demo Paysafe Js",
"availableToSettle": 1407,
"gatewayResponse": {
"code": "CRX",
"responseCode": "0",
"responseId": "713965",
"requestId": "4397082830",
"description": "Transaction has been executed successfully.",
"authCode": "682110",
"txnDateTime": "01/14/2022 at 08:17:03 EST",
"referenceNbr": "1420817031393",
"responseReasonCode": "00",
"cvv2Result": "S",
"avsResponse": "UNKNOWN",
"cvvVerification": "NOT_PROCESSED",
"serializable": true
},
"profile": {
"locale": "en",
"firstName": "John",
"lastName": "Smith",
"email": "john@smith.com"
},
"card": {
"cardExpiry": {
"month": "3",
"year": "2025"
},
"cardType": "VI",
"cardBin": "411111",
"lastDigits": "1111",
"cardCategory": "CREDIT"
}
}
If the card specified or identified by a handle in the request is enrolled in 3DS, there will be an authentication object in the response and this will contain details of the enrollment.
Verifications
See verification
Call the following endpoint from your server to take payment: POST
POST /paymenthub/v1/verifications
Verifications Request Example
curl -X POST https://api.test.paysafe.com/paymenthub/v1/verifications \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"amount": 1407,
"currencyCode": "USD",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"description": "Demo Paysafe Js"
} '
Prior to trying the example, you should:
- Replace the API key username and password (after the -u) with the Test API key you have received from Paysafe.
- Substitute the paymentToken with the Test card token you obtained from Paysafe.js.
If your account has AVS (address verification system) enabled, you must include a billing address in the authorization call using the billingDetails object. The billing address is the address of the card represented by the payment token. Note that Developer Center test accounts have AVS enabled.
Verifications Response Example
{
"id": "dc04b025-796a-4538-a738-a2ff0b83a11e",
"paymentType": "MAZOOMA",
"merchantRefNum": "SriTest-1644827349",
"currencyCode": "USD",
"txnTime": "2022-02-14T08:29:27Z",
"billingDetails": {
"street1": "Queen Street West",
"street2": "Queen Street",
"city": "Imphal",
"zip": "14236",
"state": "NY",
"country": "US"
},
"status": "COMPLETED",
"amount": 100,
"updatedTime": "2022-02-14T08:29:28Z",
"statusTime": "2022-02-14T08:29:28Z",
"liveMode": false,
"simulator": "EXTERNAL",
"gatewayResponse": {
"processor": "MAZOOMA"
},
"mazooma": {
"consumerId": "PP_100222",
"achBankAccounts": [
{
"lastDigits": "11",
"bankName": "CHASE",
"paymentToken": "BAFtcP4i8r0udbEK"
}
]
},
"profile": {
"firstName": "ALBERTA",
"lastName": "BOBBETHCHARLESON",
"email": "accountholder0@example.com",
"dateOfBirth": {
"day": 23,
"month": 12,
"year": 1990
},
"phone": "1234567890"
}
}
Standalone Credit
Call the following endpoint from your server to take payment:
POST /paymenthub/v1/standalonecredits
curl -X POST https://api.test.paysafe.com/paymenthub/v1/standalonecredits \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"amount": 1407,
"currencyCode": "USD",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"description": "Demo Paysafe Js"
} '
Prior to trying the example, you should:
- Replace the API key user name and password (after the -u) with the Test API key you have received from Paysafe.
- Substitute the paymentToken with the Test card token you obtained from Paysafe.js.
If your account has AVS (address verification system) enabled, you must include a billing address in the authorization call using the billingDetails object. The billing address is the address of the card represented by the payment token. Note that Developer Center test accounts have AVS enabled.
Standalone Credit Response Example
{
"id": "e075f2ae-dfc4-4f6d-8d89-61158367b6a6",
"amount": 1407,
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"customerIp": "204.91.0.12",
"currencyCode": "USD",
"paymentType": "CARD",
"status": "PENDING",
"description": "Demo Paysafe Js""
}
Original Credit
Call the following endpoint from your server to take payment:
POST /paymenthub/v1/originalcredits
Original Credit Request Example
curl -X POST https://api.test.paysafe.com/paymenthub/v1/originalcredits \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"amount": 1407,
"currencyCode": "USD",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"description": "Demo Paysafe Js"
} '
Prior to trying the example, you should:
- Replace the API key user name and password (after the -u) with the Test API key you have received from Paysafe.
- Substitute the paymentToken with the Test card token you obtained from Paysafe.js.
If your account has AVS (address verification system) enabled, you must include a billing address in the authorization call using the billingDetails object. The billing address is the address of the card represented by the payment token. Note that Developer Center test accounts have AVS enabled.
Original Credit Response Example
{
"amount": 1407,
"merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
"paymentHandleToken": "SC7nzOK9blfEKX1r",
"customerIp": "204.91.0.12",
"description": "Demo Paysafe Js"
}
Converting a Single-Use Token to a Permanent Token
You can convert the single-use token to a re-usable permanent payment token by using it to create a profile in the Payment API —the paymentHandleTokenFrom field returned. Paysafe recommends that you verify that the single-use token corresponds to a valid card before creating the profile.