Create a Payment using our API
Let's create a Payment!
Thanks to our level 1 PCI Compliance certificate we are able to tokenize and save your customer's payment method information safely. This way your customers won't have to provide their payment method details all over again each time they make a payment to your organization. This is specially useful for recurrence.
Let's take a look at how to create a transaction. The following example is for a checkout made by card.
Remember that for generating a transaction, you'll need to have a Price, a Customer and a Card created, since you'll need to pass this information into the body of the POST request.
Step 1. Prepare the request.
You'll need to set up a POST
request to the following URL: https://api.rebill.com/v2/checkout
.
Make sure to include the Bearer token or the Api Key generated from the Dashboard in your authorization settings. You'll also need to send your organization's ID through the headers, with the key 'organization_id'.
Remember we have a Postman Collection available so you can try out any endpoint swiftly!
Step 2. Create the payload
The payload should have the following format:
{
"customer": {
"id": "bfcf005b-7d4c-4879-aa17-d3a196196352",
"card": {
"id": "c1161ab5-d91e-421d-b6ff-b9306d1c9c7a"
}
},
"prices": [
{
"id": "f6808238-9255-4694-8093-788f806296ea",
"quantity": 1
}
],
"installments": { // optional
"quantity": 6
}
}
The 'customer' object must include the customer id and the card id.
The 'prices' object must include the price id and the quantity, being 'quantity' the amount of products being payed by your customer.
The installments
property is not required. Payments with installments should be one-time, though. That is, non-recurring or cyclical. More on Installments here.
Step 3. Send the request
Once you have the payload ready, then you will be able to send the POST
request to the given URL
Step 4. Process the response
You will receive a response as successful or rejected, as mentioned. From there you'll be able to handle that information in the way that best suits your needs.
Updated about 1 month ago