Skip to content
Coritan Docs

Organization API: Customer Portal: Payment methods

The 5 Organization API operations for payment methods.

View as Markdown

Part of Customer Portal.

Method Path Summary
GET /api/v1/orgs/{org_slug}/portal/payment-methods List customer's saved payment methods
POST /api/v1/orgs/{org_slug}/portal/payment-methods/confirm Confirm payment method setup after customer approves on gateway side
POST /api/v1/orgs/{org_slug}/portal/payment-methods/setup Initiate payment method tokenization on a regional gateway account
DELETE /api/v1/orgs/{org_slug}/portal/payment-methods/{method_id} Remove (deactivate) a saved payment method
PUT /api/v1/orgs/{org_slug}/portal/payment-methods/{method_id}/default Set a payment method as the default for this customer

List customer's saved payment methods

Section titled List customer's saved payment methods

GET /api/v1/orgs/{org_slug}/portal/payment-methods

List customer's saved payment methods.

Name In Type Required
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Confirm payment method setup after customer approves on gateway side

Section titled Confirm payment method setup after customer approves on gateway side

POST /api/v1/orgs/{org_slug}/portal/payment-methods/confirm

Confirm payment method setup after customer approves on gateway side. Stores the tokenized method for future charges.

The answer always has a status. succeeded: the method is saved, and the answer holds it (id, method_type, display_label, is_default and the rest). A method the customer already saves answers the method it already is, and a bank account Stripe made from an iDEAL or Bancontact setup is saved as a SEPA Direct Debit method. processing: the bank is still confirming the method, as it does for a US bank account after micro-deposits, which can take days. Nothing is saved yet, the answer holds a message for the customer, and we save the method when the bank confirms. requires_action: the customer has a step to finish first. The answer holds a message, the client_secret to finish it in the page and, when the step is a page of the bank's, its next_action_url. We answer 400 with a plain message for a setup that failed, was canceled, or was not started from this customer.

For Square send gateway_name, session_id square and the JSON body {source_id, verification_token?, cardholder_name?, billing?}, where source_id is the token the card form made. We answer 400 with a plain message when Square refuses the card, and when saved cards are not switched on for the account. A card the customer already saves answers the method it already is.

Name In Type Required Description
org_slug path string yes
gateway_name query string yes
session_id query string yes
set_as_default query boolean no Default: True.
currency query string no

application/json

Type: Callback Data.

Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Initiate payment method tokenization on a regional gateway account

Section titled Initiate payment method tokenization on a regional gateway account

POST /api/v1/orgs/{org_slug}/portal/payment-methods/setup

Initiate payment method tokenization on a regional gateway account.

Without gateway_name we pick the account that saves cards for the currency among the card_adapters you can draw (Stripe when you name none). For Stripe the answer holds a client_secret or a redirect_url. The form offers the payment methods the account has switched on for saving: cards, Link, SEPA Direct Debit, US bank accounts and the other reusable methods. iDEAL and Bancontact are saved as a SEPA Direct Debit method. Finish with POST .../payment-methods/confirm, which answers whether the method is saved.

For Square (adapter and session_id square, requires_redirect false) draw Square's card form with public_config.application_id and public_config.location_id (the location of your store's brand), tokenize the card, and send the token to POST .../payment-methods/confirm as the JSON body {"source_id": ...}. A Square account offers this only once saved cards are switched on for it: until then we answer 400 and create nothing. Send return_url and cancel_url as for Stripe. Square does not use them.

Name In Type Required Description
org_slug path string yes
return_url query string yes
cancel_url query string yes
gateway_name query string no
currency query string no
country query string no Two-letter billing country. Defaults to the customer's country.
card_adapters query string or null no The card forms your frontend can draw, as a comma list of stripe and square. Defaults to stripe, so a frontend with no Square form keeps getting Stripe accounts. Send stripe,square once it can draw Square's card form: the quote then names whichever account your routing rules choose, and its adapter says which form to draw.
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Remove (deactivate) a saved payment method

Section titled Remove (deactivate) a saved payment method

DELETE /api/v1/orgs/{org_slug}/portal/payment-methods/{method_id}

Remove (deactivate) a saved payment method.

Name In Type Required
method_id path integer yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.

Set a payment method as the default for this customer

Section titled Set a payment method as the default for this customer

PUT /api/v1/orgs/{org_slug}/portal/payment-methods/{method_id}/default

Set a payment method as the default for this customer.

Name In Type Required
method_id path integer yes
org_slug path string yes
Status Meaning
200 Success.
422 The request is not valid. detail lists each problem.