This guide describes how to create a transaction by directly communicating with the Rebilly API.
If you are not PCI-DSS compliant, use the FramePay JavaScript library to tokenize payment data or use a Hosted payment form to process payments.
To complete this guide, you need a Rebilly account, a website ID, an organization ID, and a secret API key. You must also have at least one payment gateway configured in your Rebilly account. If you are testing in the sandbox environment, a test payment gateway called TestProcessor
is already configured.
Obtain your organization ID, website ID, and secret API key
When you first log in to Rebilly, you create an organization as part of the setup process. A default website is created when a new organization is created. For more information, see Organizations and websites.
- Log in or sign up to Rebilly.
- Obtain your organization ID and website ID:
- In the left navigation bar, press Settings .
- In the Management section, press My organization & websites.
- In the Organization details section, note the ID value.
- In the Website section, note the ID value. For more information, see Organizations and websites.
- Obtain your secret API key:
- In the left navigation bar, press Automations .
- In the Development section, press API keys.
- Optionally, if you have not created a secret key:
- In top right of the screen, press Create API key.
- In the API key type section, select Secret.
- Optionally, in the Organizations dropdown, select the organizations that can use the API key.
- Optionally, in the Allowed IPs field, enter the IP addresses that are permitted to use the API key.
- Press Save API key.
- Go to the API keys page.
- Select a secret key and copy the Key value.
Configure a payment gateway
To set up or configure a payment gateway, see Set up a payment gateway.
This step creates or updates (upserts) a customer with a specified ID.
This operation prevents duplicate customers. If the customer already has an identifier within your system, that customer is updated. If the customer does not have an identifier, a new customer is created.
For detailed information about this API operation, see Upsert a customer.
Interactive example
How to use the interactive example
- Select the sandbox server environment:
- In the top right of the interactive example, press the Environment dropdown.
- Select Sandbox server.
- Enter your organization ID:
- Locate
server /customers/{id}
, pressserver
, then press . - In the Server variables section, press Edit.
- In the Value field, enter your organization ID and press Save.
- Locate
- Enter your secret API key:
- Press Security.
- In the API key field, press
{{SecretApiKey}}
, then press Set value. - In the Value field, enter your secret Rebilly sandbox API key and press Save.
- Enter a customer ID:
- In the URL field, press
{{id}}
. - Press Edit in path.
- In the Value field, enter a customer ID.
Example:cus_01HDP7FFX2PGDVH1995EA4QY95
.
- In the URL field, press
- Enter your website ID:
- Press Body.
- In the
websiteId
field, enter your website ID. - Optionally, change the customer details.
- Press Send.
In the response, note theid
value. This is the customer ID.
This step creates a payment instrument for the customer you created in the previous step. The payment instrument can be a credit card, bank account, or other payment method supported by Rebilly. This example uses a payment card payment instrument and contains test payment card details. For more test payment card details, including payment cards to test failed transactions, see Test payment cards, IBANs, and ACH details.
For detailed information about this API operation, see Create a payment instrument.
Interactive example
How to use the interactive example
- Select the sandbox server environment:
- In the top right of the interactive example, press the Environment dropdown.
- Select Sandbox server.
- Enter your organization ID:
- Locate
server /payment-instruments
, pressserver
, then press . - In the Server variables section, press Edit.
- In the Value field, enter your organization ID and press Save.
- Locate
- Enter your secret API key:
- Press Security.
- In the API key field, press
{{SecretApiKey}}
, then press Set value. - In the Value field, enter your secret Rebilly sandbox API key and press Save.
- Enter a customer ID:
- Press Body.
- In the
customerId
field, enter a customer ID.
Example:cus_01HDP7FFX2PGDVH1995EA4QY95
.
- Press Send.
In the response, note theid
value. This is the ID of the payment instrument.
This step creates a transaction using the customer and payment instrument you created in the previous steps. The transaction can be a sale, authorization, or other type of transaction supported by Rebilly. This example creates a sale transaction with a specified amount and currency and uses the payment instrument created in the previous step.
For detailed information about this API operation, see Create a transaction.
Interactive example
How to use the interactive example
- Select the sandbox server environment:
- In the top right of the interactive example, press the Environment dropdown.
- Select Sandbox server.
- Enter your organization ID:
- Locate
server /transactions
, pressserver
, then press . - In the Server variables section, press Edit.
- In the Value field, enter your organization ID and press Save.
- Locate
- Enter your secret API key:
- Press Security.
- In the API key field, press
{{SecretApiKey}}
, then press Set value. - In the Value field, enter your secret Rebilly sandbox API key and press Save.
- Enter website ID, customer ID, and payment instrument ID:
- Press Send.
In the response, note theid
value. This is the ID of the transaction.
Theresult
andstatus
fields specify the outcome of the transaction. For example, if the transaction was successful, theresult
field isapproved
and thestatus
field iscompleted
.
No gateway accounts available for this transaction
If you receive a declined
result with the reason No gateway account available to process this transaction
, check your gateway account settings in Rebilly. Ensure that a gateway account is configured for the currency, payment method, and website ID. For more information, see Set up a payment gateway.
Result unknown and status waiting-approval
If you receive a response with a result
value of unknown
and a status
value of waiting-approval
, the transaction requires user approval or interaction. For more information, see User approval/interaction required.
This step retrieves the transaction you created in the previous step. You can view the transaction details, including the status, amount, and payment method used.
For detailed information about this API operation, see Get a transaction.
To view the transaction in the Rebilly UI, see View the transaction details.
Interactive example
How to use the interactive example
- Select the sandbox server environment:
- In the top right of the interactive example, press the Environment dropdown.
- Select Sandbox server.
- Enter your organization ID:
- Locate
server /transactions/{id}
, pressserver
, then press . - In the Server variables section, press Edit.
- In the Value field, enter your organization ID and press Save.
- Locate
- Enter your secret API key:
- Press Security.
- In the API key field, press
{{SecretApiKey}}
, then press Set value. - In the Value field, enter your secret Rebilly sandbox API key and press Save.
- Enter a transaction ID:
- In the URL field, press
{{id}}
, then press Set value. - In the Value field, enter a transaction ID.
Enter theid
value from the response in Step 3.
- In the URL field, press
- Press Send.