Payment Request

post
Create A New Invoice

https://shop.rexdigital.group/api/v1/payment-request
Request
Response
Request
Body Parameters
custom
optional
string
Any parameter that would be useful to receive back in webhook messages.
currency
required
string
The currency the invoice should be, in a three-letter ISO format: https://www.iso.org/iso-4217-currency-codes.html
payment_method
optional
array
The payment method the customer will pay with. (See 'Payment Methods' for a full supported list). Leave empty to allow all.
transaction_id
required
string
An unique identifier for the transaction.
amount
required
number
Your calculated amount of the total price of the lines. (See 'Line Object' below, for the math).
lines
required
array
An array of line object(s) (see 'Line Object' below).
api_key
required
string
Your api key which can be found by going to your store. Clicking on the cogwheel and navigating to the developer tab.
api_signature
required
string
Your unique signature (see 'Signing Requests' below).
sales_tax
optional
number
A float of sales tax amount to be added on top.
customer
optional
object
A billing address object (see 'Billing Address' below).
shipping
optional
object
A shipping address object (see 'Shipping Address' below).
return_url
optional
string
The url to return customer to when they have finished the checkout flow (Do not use this to confirm payment).
webhook_url
optional
string
The url you wish to receive instant updates about the payment for the invoice (See 'Webhook Url' below).
Response
200: OK
Creating a successful invoice returns the redirect url which you should then redirect the customer to.
{
"redirect_url": "https://shop.rexdigital.group/pay-by-link/TRANSACTIONID/checkout"
}

Payment Methods

For a full list of supported payment methods please visit: Payment Methods

Line Object

Name

Type

Description

Example

title

String

The name of the line, this is shown to customers.

Imposter Disguise

unit_price

Float

The price per unit.

15.33

units

Integer

The amount of units the customer is buying.

2

discount

Float

The discount amount applied to the invoice.

0.65

total=unit_priceunitsdiscounttotal = unit\_price * units - discount

The total price for Imposter Disguise would be 30.01

Billing Address

An object to automatically fill out the customer billing information. If you do this for them they will automatically skip the step. See the structure here: Billing Address

Shipping Address

An object to automatically fill out the customer's shipping information. If you do not fill this we will assume shipping is the same address as the billing address above. You can also ignore it if no shipping is required.

See the structure here: Shipping Address

Webhook URL

Webhook URL's is the only way to confirm the status of a transaction. You will receive information instantly once a change to the transaction occurs. To see how to implement it please visit Webhooks

Signing Requests

<?php
function sign_webhook($invoiceDetails, $secret) {
return hash_hmac('sha256', implode('', [
$invoiceDetails['api_key'],
$invoiceDetails['payment_method'],
$invoiceDetails['amount'],
$invoiceDetails['currency'],
$invoiceDetails['transaction_id']
]), $secret);
}