Skip to content

Card Gateway Sale

Process a payment using a sale operation. This handles authorizing the card and capturing the payment in a single request.

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.
payment_methodrequired | arrayPayment method information, typically an array containing details about the payment method.
payment_method.typerequired | stringType of payment method, should be a string representing the payment method type "credit_card" or "cashplus"

Returns

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

Request

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

Method: POST

bash
$ curl --location --request POST 'https://youcanpay.com/api/pay' \
    --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"' \
    --form 'payment_method[type]="credit_card"'

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"
}