Create a Payment Method (Card)
Once a customer is created, you can create a payment method (card). You can create a payment method for every charge or you can reuse previously created payment methods.
By reusing payment methods, you can simplify the customer’s interactions as all the card data is tokenized on the network and there is no need to re-enter any card details.
This is especially important for merchant-initiated transactions where the customer has no interaction and it is not possible to perform data inputs or perform 3DS authentication.
API Documentation: Create Card
Request:
curl -i -X POST \
https://sandbox-api.pathly.io/payment-methods/cards \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"id": "ec7e1848-dc80-4ab0-8827-dd7fc0737b43",
"customer_id": "ec7e1848-dc80-4ab0-8827-dd7fc0737b43",
"number": "4000020000000000",
"exp_month": "01",
"exp_year": "2030",
"cvv": "0123",
"billing_details": {
"name": "Louis Griffin",
"email": "string",
"phone_number": "string",
"address": {
"country": "US",
"line1": "Passatge sant pere",
"line2": "Apartment 2",
"zip": "8397.0",
"city": "Pineda de mar",
"state": "Barcelona"
}
}
}'
When creating a payment method you will need to provide the customer_id that was created in step #2 (Create a Customer). By providing this ID, you will be linking this card to the previous customer.
A code 200 means that the payment method was created correctly. Any other code will mean that there was a problem, and you will receive a description of the issue in the response body.