Pay By Card - Existing Customer
This guide walks through the basic setup of a customer, tokenizing their card details and then creating and capturing a charge.
Step 1: Create a Customer
POSThttps://testapi.payarc.net/v1/customers
For this guide, we will create a basic customer profile containing only an email, [email protected], but if you would like to capture more of the customer's data, please review the Customer entity for details on what we support.
The response will return a new Customer object. For the next steps, you will need the newly generated customer ID KPxMADVnxMV4nNjp:
Step 2: Tokenize Card
POSThttps://testapi.payarc.net/v1/tokens
We will use this API to create a token that represents a credit or debit card used to carry out a transaction.
We are assuming the card source is INTERNET, and will capture the card number 4012000098765439, expiration month 12and year 2025 and CVV 999.
The token we receive can be used only once, to either create a new transaction or attach a new card to an existing customer.
We'll use the token ID we receive, 8YmNlwY0qY0mwEq0, for the next step.
Step 3: Assign Card to Customer
PATCH https://testapi.payarc.net/v1/customers/DPpKjVKDnDMDVnMN
We will attach the card token 8YmNlwY0qY0mwEq0 that we created at step 2 to the customer ID KPxMADVnxMV4nNjpwe created at step 1.
We will receive the updated customer entity
Step 4: Create a Charge - Keyed
POSThttps://testapi.payarc.net/v1/charges
Remember from previous steps, our customer ID is KPxMADVnxMV4nNjp, and the ID of the card we tokenized is P19v20v519L10M5y.
We will charge the customer's card $12, which will be represented by the amount 1200and fill in some additional customer data such as email [email protected], phone number 5417543010, and the customer's name, John Smith.
We will receive a Charge, in our case the charge ID is nBoLWODLMLLoOXyb
Step 5: Capture the Charge
POSThttps://testapi.payarc.net/v1/charges/{charge_id}/capture
In order to finalize our payment flow, we will need to capture the charge we created at the previous step, say, after we shipped the product. We will send again the same amount of 1200, representing the $12.
The response is
Congratulations on creating your first payment!
Updated 19 days ago