Payment Button

Implementation

The payment button is really simple in nature. For the most basic implementation all you need to do is add this piece of HTML:

<form method="POST" action="https://shop.rexdigital.group/checkout">
    <!-- Find "YOURCLIENTID" by going to your store, 
        clicking on the cogwheel(bottom left), 
        and clicking on the "developer tab". -->
    <input name="client_id" type="hidden" value="YOURCLIENTID"> 
    
    <!-- Now we'll add the products we want to add to the cart for the customer,
        the plan id can be found by using the products api, or by navigating to,
        your products in the shop, and looking at the plan 
        (The place where you set the price). -->
    <input name="products[0][plan_id]" type="hidden" value="1337">
    
    <button type="submit">Go to checkout</button>
</form>

Product Quantity

We also allow you to specify the quantity when adding products to the customers cart. All you need to do is add the quantity property to to product like shown in this example:

<form method="POST" action="https://shop.rexdigital.group/checkout">
    <input name="client_id" type="hidden" value="YOURCLIENTID"> 
    <input name="products[0][plan_id]" type="hidden" value="1337">
    
    <!-- We will add 5 products of the product above.
        If this field is not provided it defaults to: 1 -->
    <input name="products[0][quantity]" type="hidden" value="5">
    
    <button type="submit">Go to checkout</button>
</form>

Multiple Products

You can add multiple products by incrementing the index on the products object:

<form method="POST" action="https://shop.rexdigital.group/checkout">
    <input name="client_id" type="hidden" value="YOURCLIENTID"> 
    
    <!-- Our first product -->
    <input name="products[0][plan_id]" type="hidden" value="16">
    <!-- A second product -->
    <input name="products[1][plan_id]" type="hidden" value="32">
    <!-- A third product, but we are buying 3 of it. -->
    <input name="products[2][plan_id]" type="hidden" value="64">
    <input name="products[3][quantity]" type="hidden" value="3">
    
    <button type="submit">Go to checkout</button>
</form>

Optional Fields

We have a bunch of options which you can provide to customize the checkout flow for your customer. It works by adding properties to products like in the previous examples. The properties is only applied if they are not null. None of these are required by you, they will essentially act as automatically filling out the information on their behalf. Here is a list of the current accepted properties:

Property

Default

Description

quantity

1

The amount of the product

coupon_code

null

Any coupon code your store has.

address

null

The physical address of your customer.

city

null

The city name of your customer.

zip_code

null

The cip code of the city your customer lives in.

country

null

The country code of your customer. (Note: ).

email

null

The email of your customer.

name

null

The name of your customer.

custom

null

Anything you want to pass to us, we will return this to you. You could use this to identify what customer purchased the subscription.

Custom Input

If you ever need to send information to us together with purchase and would like it returned if the customer completes a transaction this is a great way to do it. You could pass through a user id if you want to know who in your database made the transaction. An example could be with a base64 encoded string:

<form method="POST" action="https://shop.rexdigital.group/checkout">
    <input name="client_id" type="hidden" value="YOURCLIENTID"> 
    <input name="products[0][plan_id]" type="hidden" value="1337">
    
    <!-- Adding a custom input which we need if the user completes the transaction. -->
    <input name="custom" type="hidden" value="ewogICJtZXNzYWdlIjogImlmIHlvdSBtYWRlIGl0IHRoaXMgZmFyIHN1YnNjcmliZSB0byBvdXIgeW91dHViZSBjaGFubmVsOiBodHRwczovL3d3dy55b3V0dWJlLmNvbS9jaGFubmVsL1VDcC1LaWFyNmswX2ZwMXQ0ekVRajdoQSIKfQ==">
    
    <button type="submit">Go to checkout</button>
</form>

Last updated