API Presentation

API Create a payment method

Pre-requisite: a payment gateway for card payments is configured.

Step 1: Generate an OAuth token

See Create an OAuth token for details.

Step 2. Create a card payment method for a customer


The following Postman and cURL code sample performs the following task:

  • Creates a card payment method


Postman example:

{{opencell.url}}/payment/paymentMethod
{
  "paymentMethodType":"CARD",
  "alias":"Stripe",
  "disabled":false,
  "customerAccountCode":"{{account.code}}",
  "cardNumber":"4111 1111 1111 1111",
  "cardType":"VISA",
  "monthExpiration":"12",
  "yearExpiration":"30",
  "owner":"{{account.firstname}} {{account.lastname}}",
  "untdidPaymentMeans":"54"
}

cURL example:

curl --location 'https://{{opencell.base}}/opencell/api/rest/payment/paymentMethod' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{access_token}}' \
--data-raw '{
  	"paymentMethodType":"CARD",
	"alias":"stripe",
	"disabled":false,
	"customerAccountCode":"CLASSIC-C00",
	"cardNumber":"4111 1111 1111 1111",
	"cardType":"VISA",
	"monthExpiration":"12",
	"yearExpiration":"30",
	"owner":"John Smith",
	"untdidPaymentMeans":"54"
}'

Answer: Code 200. The body holds actionStatus, whose status is SUCCESS, and paymentMethod, the payment method created, with its id.