HomeGuidesAPI ReferenceChangelog
Terms of Use
API Reference
Terms of Use

Payment Methods / Create

Initiate a new payment method registration, or finalize it.

Note that this is a two step process!

For payment processors with web view integration

You will need to initiate a call with no parameters to this endpoint to get a new request to add payment method (Step 1). Then you will have to redirect to an endpoint and wait for the client to enter his credit card details there. Once he/she is done (and reaches the successURL) you must then issue another call to this endpoint with the transactionID that was returned from the first call to finalize the process and retrieve the newly added payment method data (Step 2).

Step 1

POST with no request body

This will create a new request to the payment processor for adding a new payment method. As response you will get the transactionId to track the payment method registration process, the redirectUrl and successUrl, to redirect your user to, along with any other attributes that the payment processor requires for tracking. Just pass those additional parameters to Step 2.

Example

Request: No Body

Response:

[
  "transactionId": 1234,
  "successUrl": "http://example.com/payment-processor/success",
  "redirectUrl": "http://example.com/payment-processor/web-form/123abc",
  "additionalProcessorArguments": "just pass them all top the step 2"
]

Step 2

POST with request body, containing the transactionId along with any other attributes, that were in the response of Step 1 (other then the transactionId, successUrl and redirectUrl).

This will finalize the payment method registration and will retrieve the newly added payment method for you. Note that you can also receive the payment methods using the payment methods listing endpoints.

Example

Request:

[
  "transactionId": 1234,
  "successUrl": "http://example.com/payment-processor/success",
  "redirectUrl": "http://example.com/payment-processor/web-form/123abc",
  "additionalProcessorArguments": "just pass them all top the step 2"
]

Response:

[
  "data": [
    "id": 1234,
    "name": "**** 1111",
    "type": "tokenized",
    "issuer": "visa",
    "expireYear": 2026,
    "expireMonth": 5,
    "default": true,
  ]
]

For payment processors with in-app integration

Braintree and Stripe integrations DO NOT count out redirectUrl as these processors should have an ip-app integration and therefore the app itself should use the appropriate SDK to complete the credit-card tokenization process with the processor.

Braintree

The first step is not required for braintree as the full integration is done in-app. Step 2 needs to pass the paymentMethodNonce so that it can be exchanged for the payment method token.

Example Step 2

Request:

["paymentMethodNonce": "abc123"]

Response:

[
  "data": [
    "id": 1234,
    "name": "**** 1111",
    "type": "tokenized",
    "issuer": "visa",
    "expireYear": 2026,
    "expireMonth": 5,
    "default": true,
  ]
]

Stripe

Step 1 with stripe will initialize a setup intent, that your app should complete. You will get the details you need in order to do that from the response of that call. Call step 2 once you have completed the setup intent.

Example Step 1

Request: No Body

Response:

[
  "publishableKey": "345678986543",
  "clientSecret": "jyt37hgsv63",
  "setupIntentReference": "1234ABC"
]

Example Step 2

Request:

[
  "publishableKey": "345678986543",
  "clientSecret": "jyt37hgsv63",
  "setupIntentReference": "1234ABC"
]

Response:

[
  "data": [
    "id": 1234,
    "name": "**** 1111",
    "type": "tokenized",
    "issuer": "visa",
    "expireYear": 2026,
    "expireMonth": 5,
    "default": true,
  ]
]
Language
Authorization
Bearer
API Token
URL
Click Try It! to start a request and see the response here!