Payment Request

Create A New Invoice

POST https://shop.rexdigital.group/api/v1/payment-request

Request Body

Name
Type
Description

custom

string

Any parameter that would be useful to receive back in webhook messages.

currency

string

The currency the invoice should be, in a three-letter ISO format: https://www.iso.org/iso-4217-currency-codes.html

payment_method

array

The payment method the customer will pay with. (See 'Payment Methods' for a full supported list). Leave empty to allow all.

transaction_id

string

An unique identifier for the transaction.

amount

number

Your calculated amount of the total price of the lines. (See 'Line Object' below, for the math).

lines

array

An array of line object(s) (see 'Line Object' below).

api_key

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

string

Your unique signature (see 'Signing Requests' below).

sales_tax

number

A float of sales tax amount to be added on top.

customer

object

A billing address object (see 'Billing Address' below).

shipping

object

A shipping address object (see 'Shipping Address' below).

return_url

string

The url to return customer to when they have finished the checkout flow (Do not use this to confirm payment).

webhook_url

string

The url you wish to receive instant updates about the payment for the invoice (See 'Webhook Url' below).

{
    "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

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);
}

Last updated