Create a payment form using the Rebilly API

This tutorial describes how use the Rebilly API to create a customer, an order, and process a payment using a hosted payment form in the sandbox environment.

Rebilly hosted payment forms simplify the process of accepting payments. Rebilly hosts your payment form and ensures that your payments process is secure and PCI compliant.


The steps in this tutorial interact with the Rebilly API and enters the following required fields automatically using a demo account:

  • Sandbox secret key {process.env.SANDBOX_KEY}: entered in REB-APIKEY header security scheme.
  • Sandbox organizationId: b952f205-4023-4484-b808-5d3a1e410751 as a server variable.
  • Sandbox websiteId:
  • Parsed response data: customerId, recentInvoiceId, approvalUrl.

To use your own values, see Get started.

Step 1: Upsert a customer

The id value from this response is used in the next request as the customerId value.
  1. Click Parameters, then in the id field, enter an ID value for a new customer.
  2. Click Send.

For more information, see Upsert a customer with predefined ID.


Step 2: Create an order

The recentInvoiceId value from this response is used in the next request.

For more information, see Create an order.

You must enter an id value in step 1. It is used as the customerId value and is a required field in the next two steps.

You must first complete step 1.

Step 3: Pay the invoice

For more information, see Create a transaction.

  • The customer ID ( value from the step 1 response is required. It is used as the customerId value in this request.
  • The recent invoice ID (step2.response.body.recentInvoiceId) from the step 2 response is required. It is used in the invoiceIds array of this request.

You must complete the previous steps.

Redirect the user to the approval URL in the _links section of the step 3 response body.
JavaScript example: step3.response.body._links.find(link => link.rel === 'approvalUrl').

Related topics