How to Create a Payment Method
On this page, you will find a walk-through guide on creating a payment method and the necessary information to accomplish this task.
Prerequisites
Before making any call to the LINKs API, you first need a merchant account. Contact our team at Discover@LinksMerchantServices.com to get started.
Creating a Payment Method
To create a payment method in LINKs, you need to call the Create a New Payment Method endpoint. The following are the parameters needed to initiate the payment method creation:
| Field | Description | Required |
|---|---|---|
merchantIdentifier | A unique identifier for the merchant, used to associate the payment method with the correct merchant account. | Yes |
customerIdentifier | A unique identifier for the customer. This is optional and can be used to associate the payment method with a specific customer. | No |
customerReference | An optional reference provided by the merchant to identify the customer. | No |
card | Details about the credit card used for the payment method. | Yes |
billingInformation | Billing address and contact details associated with the payment method. | No |
Within the card object, the following fields are used:
| Field | Description | Required |
|---|---|---|
cardNumber | The credit card number. | Yes |
expiryMonth | The expiry month of the credit card (1-12). | Yes |
expiryYear | The expiry year of the credit card (e.g., 2025). | Yes |
cardHolderName | The name of the cardholder as it appears on the credit card. | No |
cvv | The card verification value (CVV) for the credit card. | No |
creditCardBrand | The brand of the credit card, such as Visa or MasterCard. | Yes |
You can use the code snippet below to make the endpoint call with the required parameters:
curl --request POST \
--url https://testapi.linksmerchantservices.com/api/paymentmethods \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <your_base64_encoded_credentials>' \
--data '{
"merchantIdentifier": "<your_merchant_id>",
"customerIdentifier": "<optional_customer_id>",
"customerReference": "<optional_customer_reference>",
"card": {
"cardNumber": "4111111111111111",
"expiryMonth": 12,
"expiryYear": 2025,
"cardHolderName": "John Doe",
"cvv": "123",
"creditCardBrand": "Visa"
}
"billingInformation": {
"firstLine": "540 NE 4th st",
"secondLine": "Second Floor",
"city": "FLL",
"region": "FL",
"zipCode": "33091",
"countryAlpha3Code": "USA"
},
}'
Depending on the request, LINKs API offers two forms of authentication,
Basic and client token. Refer to the Authentication
guide to learn more about it.
This will result in a JSON response exemplified below:
{
"merchantIdentifier": "af9a9d3e-3d3b-4f7d-9fde-4169f1abedd5",
"customerIdentifier": "c8ee51a9-f6c0-4108-a7c1-c8a821ffce2c",
"customerReference": "154564559",
"paymentMethodIdentifier": "583c748c-beea-4dc1-808a-2f34309e62f5",
"card": {
"cardNumber": "4111111111111111",
"expiryMonth": 12,
"expiryYear": 2025,
"cardHolderName": "John Doe",
"cvv": "123",
"creditCardBrand": "Visa"
},
"billingInformation": {
"firstLine": "540 NE 4th st",
"secondLine": "Second Floor",
"city": "FLL",
"region": "FL",
"zipCode": "33091",
"countryAlpha3Code": "USA",
"countryId": 1
},
"result": {
"resultType": "Accepted",
"merchantMessage": "",
"logIdentifier": "60554180-07ed-4cd0-92ca-3b5ac79c1fb3",
"logAsError": false
}
}
With the paymentMethodIdentifier found in the response, you can either retrieve, update or delete the newly created payment method.