This guide explains how to authorize a payment transaction with the Payabli API. Authorizing a transaction returns an authorization code and reserves funds for the merchant.

You must capture a transaction to complete the transaction and move funds from the customer to merchant account. To authorize and capture a payment in one step, use the Make a transaction endpoint instead.

This method returns an authorization code and reserves funds for the merchant. Authorized transactions aren’t flagged for settlement until they are captured.

If aren’t using a stored payment method provided by an embedded component to run transactions, you must secure cardholder, bank account data, and customer IP address because your PCI scope is expanded.

Build the request

First, choose an endpoint. If you’re testing, use the Sandbox endpoint. for your target environment.

Authenticate

Authenticate by sending your API token in the request header with the key requestToken:
--header 'requestToken: API TOKEN'

Body parameter

The body requires several fields. For a full list of available fields, see the API reference for this endpoint.

body
object

Example request

This example authorizes a card transaction for $100, with no service fee, for entrypoint f743aed24a. The customer ID is 224.

Authorize a Transaction

curl --request POST \
     --url 'https://api-sandbox.payabli.com/api/MoneyIn/authorize?forceCustomerCreation=false' \
     --header 'accept: application/json' \
     --header 'content-type: application/*+json' \
     --header 'requestToken: <API TOKEN>' \
     --data '
{
    "entryPoint": "f743aed24a",
    "paymentMethod": {
        "method": "card",
        "cardnumber": "4111111111111111",
        "cardexp": "0330",
        "cardcvv": "737",
        "cardzip": "33625",
        "cardHolder":"John Smith"
    },
    "paymentDetails": {
        "totalAmount"100.00,
        "serviceFee": 0.00
    },
    "customerData": {
        "customerId": 224
    }
}'

Response

A successful request returns a 200 response with a JSON body with a referenceId of 10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13. If the payment is declined, the responseText reads Declined.

Success
{
    "responseText": "Success",
    "isSuccess": true,
    "responseData": {
        "authCode": "123456",
        "referenceId": "10-7d9cd67d-2d5d-4cd7-a1b7-72b8b201ec13",
        "resultCode": 1,
        "resultText": "Authorized",
        "avsResponseText": "No address or ZIP match only",
        "cvvResponseText": "CVV2/CVC2 no match",
        "customerId": 224,
        "methodReferenceId": null

    }
}

You can view transactions in the UI in your PayHub or PartnerHub account.

Next, capture the transaction to complete the transaction and move funds from the customer to merchant account.