Recurring

Summary

Recurring occurs when a customer is charged again for a subscription, upsell, or downsell. To ensure a successful rebilling, the original transaction must have the isRecurring attribute set to true within the initialize, set, connect, or .beforeSend methods of the Open Elements JavaScript.

Examples

Initialize

You can set the first transaction to a recurring payment in the initialization of the Open Elements.

            let oe = new openElements('Mg2KYmzEGPn2Q4Kf', {
                total: 2.50,
                currency: "USD",
                isRecurring: true,
                recurringPeriod: monthly // daily, monthly, yearly
            });

Set

After initialization, you can change or set the recurring flags.

            oe.set({
                isRecurring: true,
                recurringPeriod: monthly // daily, monthly, yearly
            });

Connect

You can connect Open Elements to fields in your HTML form to read the flags from.

            oe.connect({
                isRecurring: "#isRecurringBillingCheck",
                recurringPeriod: "#recurringPeriod"
            });

Before Send

Before the transaction is sent to the processor, you can modify the recurring flags.

            oe.beforeSend(async (data) => {
                return {
                    ...data,
                    isRecurring: true,
                    recurringPeriod: monthly // daily, monthly, yearly
                }
            });

API Endpoint

The example below you can send the data as Query String Parameters, Form-Data or WWW Form URL Encoded attributes.

POST https://api.openpath.io/api/transact.php

customer_vault=sale
username=TZSdpU2VhaWcTZZ7
password=hsStGpREZVrG2M3Fkdqxwy4h
customer_vault_id=payment_eck3Nc3ACdP73H7Xr3TayT3hRA9WX7P49MWNhqeq7A449Pc2
amount=19.95

NameAttributeDescription
Customer Vaultcustomer_vaultAssociate payment information with a Customer Vault record if the transaction is successful.
Values: sale, add_customer or update_customer
UsernameusernameThis is the API Login ID from your Site Path.
PasswordpasswordThis is the Transaction Key from your Site Path.
Customer Vault IDcustomer_vault_idSpecifies a Customer Vault ID.
AmountamountThe amount to charge the consumers Vaulted card.

Response

response=1&responsetext=100 | SUCCESS&authcode=123456&transactionid=9848880910&orderid=&type=sale&response_code=100

Did this page help you?