Skip to content

Card Gateway Authorization

Process a payment using an authorization operation. This is faster than the sale operation as it only authorizes the payment. The capture is then done asynchronously within 30 seconds of the authorization.

Note: If you intend to use the sandbox, you should use the following base URI: https://youcanpay.com/sandbox/api/

Parameters

ParameterTypeDescription
pub_keyrequiredMerchant account's public key.
token_idrequiredA tokenized payment ID.
credit_cardrequiredThe card's number.
card_holder_namerequiredThe card holder's name, used for AVS verification.
cvvrequiredCard verification value number, usually on the back of the card.
expire_daterequiredCard expiry date in MM/YY format.

Returns

A transaction ID if successful. Returns redirect and return URLs if the card has 3DS enabled.

Request

Endpoint: https://youcanpay.com/api/authorize

Method: POST

bash
$ curl --location --request POST 'https://youcanpay.com/api/authorize' \
    --header 'Accept: application/json' \
    --form 'pub_key="pub_d8116a60-ece8-4e14-b475-c8d349a5"' \
    --form 'token_id="1e7862f6-266b-46b1-b550-afcd34f4b76f"' \
    --form 'expire_date="10/24"' \
    --form 'credit_card="4012888888881881"' \
    --form 'cvv="000"' \
    --form 'card_holder_name="John Doe"'

Response

The response object

json
{
  "success": true,
  "code": "000",
  "message": "The payment was processed successfully",
  "transaction_id": "f78d4a85-80bf-4405-8aef-9b256ce3f8ac",
  "order_id": "12"
}