Other Payment Processors
Server-Side Integration
If you don't use Stripe, or want more control over the data you're sending to Rewardful, you can use our Server-Side Integration method. With this method, you can automate sending your sales data instead of using our Stripe App integration method. This allows you to connect Rewardful to any payment processor you want and to have more granular control over the sales data you are sending Rewardful.
In general, most payment processors work by sending a webhook to notify your application that a payment was successful, that a trial has started, that a subscription has been canceled, or that a payment has been refunded. When receiving these webhooks you likely provision or remove access to your service. To use Rewardful's server-side integration you just need to include a few API calls to our API within your existing customer lifecycle management.
Requirements
Before you start implementing the Server-Side Integration Method, you will need to have completed the following configurations:
1. Specify your display currency.
2. Create your first campaign.
Key Concepts
Link tracking/creating referrals
Converting referrals to leads
Creating sales/converting leads
Handling refunds/updating sales
Link tracking/creating referrals
In order to track referrals from affiliates it is necessary to install Rewardful's Javascript tracking snippet. This snippet should be installed wherever you want affiliates to be able send traffic to and have it tracked.
When a customer visits your website via an affiliate link the tracking snippet will install a first party cookie on the users' browser. This cookie will persist on the user's browser and will be valid for the period that you define in your Rewardful account settings.
The Rewardful tracking snippet also makes available a Javascript method that allows you to get the referral ID of the customer referral that was created.
When a customer is signing up you will want to save this referral ID, either to your application database, or on your payment processor as metadata. The referral ID is a UUID that can be used later for converting referrals to leads, and for creating sales related to that referral using our REST API.
Converting referrals to leads
It's up to you when in your customer lifecycle you want to convert a referral to a lead. The two most common moments are either (1) when a customer signs up for your application or (2) when a customer starts a trial for your application.
In order to convert a referral to a lead you will need to use our convert a referral to a lead endpoint using the referral ID.
Creating sales/conversions
When a customer makes a purchase, you can let Rewardful know using the Create sale endpoint. This would typically be after you receive a webhook from your payment processor indicating that a successful payment has been received from a customer.
The first time a sale is created for a customer/referral, it will be viewed within the Rewardful dashboard as a conversion for stats purposes. Each sale you send to Rewardful will generate a commission according to the rules of the campaign to which the affiliate responsible for the underlying referral is linked. Subsequent sales from this customer/referral will not increase the conversion count but will generate commissions.
Handling refunds/updating sales
If a customer is refunded for a purchase in your payment processor or their charge increases, you can update the corresponding sale in Rewardful using the Update sale endpoint.
When a sale is updated, the associated commission that Rewardful generated for that sale will be updated accordingly. However, if the associated commission has already been marked as paid, our system will not update it.
The sale object
Sales represent purchases from referrals. Commissions distributed to affiliates are calculated based on sales generated from their referrals.
Below is an example of a sale object.
Attributes
id
string
Unique identifier for the sale (UUID).
created_at
string
Time at which the sale was created.
updated_at
string
Time at which the sale was last updated.
currency
string
ISO currency code in which the sale is denominated.
charged_at
string
Time at which the sale was charged.
stripe_account_id
string
The Stripe account associated with the sale.
stripe_charge_id
string
The technical ID of the sale in Stripe.
invoiced_at
string
Time at which the sale was invoiced.
charge_amount_cents
integer
The amount charged for the sale, in cents.
refund_amount_cents
integer
The refunded amount of the sale, in cents.
tax_amount_cents
integer
The tax amount of the sale, in cents.
sale_amount_cents
integer
The amount of the sale, tax excluded, in cents.
referral
object
The referral of the actual customer who made the purchase.
referral.id
string
Unique identifier of the referral.
referral.stripe_account_id
string
The ID of the customer's Stripe account.
referral.stripe_customer_id
string
The ID of the customer in Stripe.
referral.conversion_state
string
The state of the client regarding their conversion.
referral.deactivated_at
string
If the referral is deactivated, the deactivation date will be shown.
referral.expires_at
string
Time at which the referral will expire.
referral.created_at
string
Time at which the referral was created.
referral.updated_at
string
Time at which the referral was updated.
customer
object
Information on the customer.
customer.platform
string
The platform in which the customer is registered.
customer.id
string
The ID of the customer in Stripe.
customer.name
string
Customer's name.
customer.email
string
Customer's email address.
visits
integer
Number of visits that customer made to your website.
link
object
Information on the referral link used.
link.id
string
The referral link unique ID.
link.url
string
The URL of the referral.
link.token
string
The referral token. The unique part of the referral link.
link.visitors
integer
The total amount of visitors using that referral link.
link.leads
integer
The total amount of leads related to that referral link.
link.conversions
integer
The total amount of conversions from that referral link.
Last updated
Was this helpful?