POST
/
api
/
v1
/
server-to-server-interface
/
payment
curl --request POST \
  --url https://api-dev.paymentoptions.com/api/v1/api/v1/server-to-server-interface/payment \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "amount": "1000",
  "currency": "JPY",
  "card": {
    "cvc": "100",
    "expiry_month": "12",
    "expiry_year": "24",
    "name": "John Doe",
    "number": "5200000000001005"
  },
  "merchant_txn_ref": "qwe",
  "customer_ip": "127.0.0.1",
  "merchant_id": "< Merchant ID >",
  "return_url": {
    "webhook_url": "< Webhook url >",
    "success_url": "http://www.successurl.com/",
    "decline_url": "http://www.declineurl.com/"
  },
  "billing_address": {
    "country": "JP",
    "email": "billing@testemail.com",
    "phone_number": "8112345678",
    "address1": "1-2-3 Shinjuku",
    "city": "Shinjuku-ku",
    "state": "Tokyo",
    "postal_code": "1600022"
  },
  "shipping_address": {
    "country": "JP",
    "email": "shipping@testemail.com",
    "phone_number": "8112345678",
    "address1": "1-2-3 Shinjuku",
    "city": "Shinjuku-ku",
    "state": "Tokyo",
    "postal_code": "1600022"
  },
  "browser_info": {
    "acceptHeader": "text/html",
    "screenColorDepth": "48",
    "javaEnabled": false,
    "language": "en",
    "screenHeight": "1200",
    "screenWidth": "1600",
    "challengeWindow": "4",
    "userAgent": "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
  },
  "time_zone": "Asia/Kuala_Lumpur"
}'
{
  "success": true,
  "status_code": 201,
  "is_live": false,
  "transaction_type": "PRE_AUTH",
  "gateway_response": {
    "version": "1",
    "type": "INFO",
    "message": "Payment Successful.",
    "code": "INFO0000"
  },
  "merchant_details": {
    "legal_name": "Tink15 Factory",
    "mid": "< Merchant ID >",
    "merchant_txn_ref": "qwe",
    "billing_details": {
      "billing_address": {
        "country": "JP",
        "email": "billing@testemail.com",
        "phone_number": "8112345678",
        "address1": "1-2-3 Shinjuku",
        "city": "Shinjuku-ku",
        "state": "Tokyo",
        "postal_code": "1600022"
      }
    },
    "device_details": {
      "visited_ip": "127.0.0.1",
      "customer_ip": "127.0.0.1"
    }
  },
  "payment_details": {
    "amount": 1000,
    "response_code": 0,
    "auth_code": "917290",
    "currency": "JPY",
    "payment_method": "ECMC-SSL",
    "scheme": "MASTERCARD",
    "card": {
      "name": "John Doe",
      "number": "5200000000001005",
      "exp_month": "12",
      "exp_year": "24"
    },
    "additional_data": {
      "payment_data_source": {
        "type": "card"
      }
    }
  },
  "transaction_details": {
    "id": "ab8444e7-fec0-40dd-994d-0ad813785f74",
    "ref": 74797,
    "timestamp": "2024-11-25T07:22:48.000Z",
    "merchant_txn_ref": "qwe",
    "stored_payment_method_id": null
  },
  "risk-details": {
    "risk_score": null
  }
}

Key Points

  • The Purchase API processes and completes payments instantly by capturing and authorizing funds at the same time.

  • This API is ideal for transactions where the amount is fixed, and the payment must be finalized instantly, such as online retail purchases or digital goods sales.

  • After a successful purchase, the transaction can be refunded if necessary, allowing the merchant to return the funds to the customer.

Flow diagram

Api Parameters

Authorizations

Authorization
string
header
required

API Key for Authorization. Format: 'Basic YOUR_API_KEY_HERE'

x-api-key
string
header
required

API Key specific to x-api-key.

Body

application/json
The request payload to process a payment transaction.
amount
string
required

The amount of the transaction.

Example:

"1000"

currency
string
required

The abbreviation of the processing currency of the product (e.g., JPY).

Maximum length: 3
Example:

"JPY"

card
object
required

A JSON object containing the Card Details.

merchant_id
string
required

The merchant ID (DASMID).

Maximum length: 128
Example:

"< Merchant ID >"

billing_address
object
required

A JSON object containing the billing address of the cardholder.

merchant_txn_ref
string

The merchant transaction reference ID.

Maximum length: 45
Example:

"qwe"

customer_ip
string

The IP address of the cardholder.

Maximum length: 45
Example:

"127.0.0.1"

return_url
object

A JSON object containing the Return URL. (This field is mandatory for 3DS transactions.)

shipping_address
object

A JSON object containing the shipping address of the cardholder (optional).

browser_info
object

A JSON object containing details about the browser used by the cardholder (optional).

time_zone
string

The country time zone of the transaction.

Maximum length: 128
Example:

"Asia/Kuala_Lumpur"

Response

201 - application/json
Payment authorized successfully
success
boolean

True on successful transaction, false on failure.

Example:

true

status_code
integer

The status code of the transaction.

Example:

201

is_live
boolean

True if live transaction, false if test transaction.

Example:

false

transaction_type
string

The transaction type (e.g., PRE_AUTH).

Example:

"PRE_AUTH"

gateway_response
object

A JSON object containing the response from the gateway.

merchant_details
object

A JSON object containing the details of the merchant.

payment_details
object

A JSON object containing the payment details.

transaction_details
object

A JSON object containing details of the transaction.

risk-details
object

A JSON object containing details of risk.