Payment API

Create Payment

Request

To create a Payment you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Required fields (described below)

You can find a demo on this link Demo Redirect

Request endpoint details

name
value
description

path

v2/payment/new

This path is used for create action

method

POST

We are creating/updating resource, hence POST method

Request body:

field
length
type
required
description

amount

1-11

Integer

YES

amount is in minor units, ie. 10.24 USD is sent as 1024

order_number

2-40

String

YES

unique order identifier

currency

3

String

YES

One of supported currencies (BAM, EUR, USD, CHF etc)

transaction_type

enum

String

YES

possible values are: authorizeor purchase

order_info

3-100

String

YES

short description of order being processed

scenario

enum

String

NO

possible values are: chargeor add_payment_method

supported_payment_methods

predefined

Array<String>

NO

An array of pan-tokens and/or card (see below for more details)

customer_uuid new

20

String

NO

An id of a customer. Check documentation how to create a customer.

Scenario charge charges customer amount. Depending on transaction_type amount is reserved (authorize) or captured (purchase).

Scenario add_payment_method provides simple way to implement 'Save card for future payments' functionality.

----------------------------------------------

WARNING - add_payment_method scenario will automatically execute refund or void depending on transaction type. ONLY use for saving cards.

----------------------------------------------

Supported payment methods

supported_payment_methods in an array of valid payment methods.

Valid payment methods are:

  • card - representing new card

  • <pan_token> - secure vault token - Secure Vault Tokens

Requirements / options:

  • If payment method card is provided then user will be able to enter new card instead of selecting one of saved cards

    • User must enter card number

    • Expiry date

    • Cvv

  • If payment method <pan_token> is provided provided and valid(cards not expired, valid tokens etc)

    • Then only cvv input will be updaten on the payment form.

    • All other information (masked pan, expiry date etc) will be pre filled.

  • Multiple tokens can be sent. In that case, the user will have an option which card to use.

Example of valid payment methods:

{
  "supported_payment_methods": [
    "f167252fecfeff8f134001bf8e7a700c53e8653f631362dd84913e23260199bf",
    "0df5d4eac4f36d0dee9f48c17ddac2f66c12e5edfc4f92a92d3e6085f31368ea",
    "card"
  ]
}

Setup above will result in:

  • preselected saved card with token f167252fecfeff8f134001bf8e7a700c53e8653f631362dd84913e23260199bf

  • with an option to select card with token 0df5d4eac4f36d0dee9f48c17ddac2f66c12e5edfc4f92a92d3e6085f31368ea

  • with an option to enter new card

Response

field
length
type
description

status

enum

String

approved, invalid-request or error

client_secret

40

String

Client secret

id

40

String

Payment id

message

-

String

OPTIONAL - available if status is error or invalid-request

Example of response:

{
  "status": "approved",
  "id": "992a1c068e7d1254672de48cc47efc98468a5bc4",
  "client_secret": "992a1c068e7d1254672de48cc47efc98468a5bc4"
}

Update

To update previously created Payment you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Create resource beforehand

  • Provide valid resource id

Request

name
value
description

path

/v2/payment/<payment-id>/update

id of previously created resource

method

POST

We are creating/updating resource, hence POST method

Request body:

field
length
type
required
description

amount

1-11

Integer

YES

amount is in minor units, ie. 10.24 USD is sent as 1024

Response

field
length
type
description

status

enum

String

approved, invalid-request or error

client_secret

40

String

Client secret

amount

1-11

Integer

amount is in minor units, ie. 10.24 USD is sent as 1024

currency

3

String

One of supported currencies (BAM, EUR, USD, CHF etc)

id

40

String

Payment id

message

-

String

OPTIONAL - available if status is error or invalid-request

Example of response:

{
  "status": "approved",
  "id": "992a1c068e7d1254672de48cc47efc98468a5bc4",
  "client_secret": "992a1c068e7d1254672de48cc47efc98468a5bc4",
  "amount": 100,
  "currency": "BAM"
}

Last updated