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.

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;

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 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 https://developer.paysafe.com/en/paysafe-payments-api/payments/api/#/reference/payments/payments/process-payment

Call the following endpoint from your server to take payment: POST

POST/paymenthub/v1/payments

Payment Request Example

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 https://developer.paysafe.com/en/paysafe-payments-api/payments/api/#/reference/verifications/verification/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 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.

Verifications Response Example

{
  "id": "71aea8ae-e801-4df3-9436-c5a61c88d3ad",
  "paymentHandleToken": "SC7nzOK9blfEKX1r",
  "merchantRefNum": "10f64573-65d8-4d14-8337-66264094662f",
  "customerIp": "10.10.12.64",
  "currencyCode": "USD",
  "paymentType": "CARD",
  "description": "Verify card for payment request",
  "txnTime": "2018-12-11T16:33:49Z",
  "gatewayResponse": {
    "authCode": "XXXXXX",
    "avsResponse": "MATCH",
    "cvvVerification": "NOT_PROCESSED"
  },
  "status": "COMPLETED"
}

Standalone Credit

See https://developer.paysafe.com/en/paysafe-payments-api/payments/api/#/reference/standalone-credits/standalone-credits/process-standalone-credit

Call the following endpoint from your server to take payment: POST

POST/paymenthub/v1/standalonecredits

Standalone Credit Request Example

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

See https://developer.paysafe.com/en/paysafe-payments-api/payments/api/#/reference/original-credits/original-credits/process-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.

Did you find this page useful?