Sign up flow
Excited to get started, it is always fun to start with something new. Upodi provides this overview as a simple guide how to easily get started with signing up customers and what the flow is. This overview does expect that you have setup your product plans in Upodi and completed products and pricing. It also assumes that you have configured your API keys and know how to handle code.
Setting up your products and pricing is done within Upodi - sign in here.
Step 1 - To create a new customer, use the API or our C# SDK:
POST https://api.upodi.io/v2/customers/ HTTP/1.1
{
"accountnumber" : "CU-000120",
"currencycode" : "EUR",
"autobill" : true,
"fullname" : "Sample Customer"
}
UpodiService upodi = new UpodiService(ApiKey);
Guid customerId = upodi.Customers.Create(new Customer {
AccountNumber = "CU-000120",
CompanyName = "Sample Customer",
CurrencyCode = "EUR",
AutoBill = true
});
curl --request POST \
--url https://api.upodi.io/v2/customers
Step 2a - Integrate your desired payment provider
Payment providers integrate easily with Upodi. Most of our credit card payment providers (PSP) integrate token based card processing, which reduce your PCI requirement level to a minimum and leave card data securely stored with the PSP.
Step 2b completes the PSP integration by assigning the token or card as the default payment method.
Payment Provider | Implementation Guide | Sample |
---|---|---|
QuickPay | Setting up subscription tokens | Sample |
PayLike.io | Integrating PayLike | Sample |
Stripe | Working with tokens | Sample |
Step 2b - Assign a default payment provider using the returned token
The default payment method will be used upon billing to charge the customer automatically. If no payment method is added (skipping step 2a) - the customer will recieve a manual invoice.
POST https://api.upodi.io/v2/paymentmethods/:customerid/ HTTP/1.1
{
"type" : 64,
"makedefault" : true,
"puretoken" : {
"paymentgateway" : "stripe",
"token" : "cus_D4dj38f8990092"
}
}
UpodiService upodi = new UpodiService(ApiKey);
// this example use stripe as a payment gateway
upodi.PaymentMethods.CreatePaymentMethod(customerId, new CreatePaymentMethodRequest {
MakeDefault = true, // make the new payment method default
Type = PaymentMethodTypeEnum.PureTokenBased,
TokenBased = new CardToken
{
PaymentGateway = "stripe",
Token = "cus_D4dj38f8990092"
}
});
curl --request POST \
--url https://api.upodi.io/v2/paymentmethods/customerid
Step 3 - Create a subscription on the customer
Subscriptions binds the legal period and a desired product plan to the customer.
POST https://api.upodi.io/v2/subscriptions/ HTTP/1.1
{
"subscriptionnumber" : "SUB-203383",
"customerid" : "- customer id returned from step 1",
"productplanid" : "- guid of plan from Upodi -",
"startdate" : "2018-01-01 00:00:00",
"enddate" : "2018-01-01 00:00:00",
"autorenew" : true,
"initialterminterval" : 1, /* 1 year */
"initialtermperiod" : 500, /* year(s) */
"renewalterminterval" : 1, /* 1 year */
"renewaltermperiod" : 500 /* year(s) */
}
UpodiService upodi = new UpodiService(ApiKey);
Guid subscriptionId = upodi.Subscriptions.Create(new Subscription
{
SubscriptionNumber = "SUB-203383",
StartDate = LastDayOfMonth(DateTime.UtcNow),
AutoRenew = true,
CustomerID = customerId,
ProductPlanID = Guid.Parse(ProductPlanId), // the product plan id from Upodi
Initial = new AnnualTerm(1),
Renewal = new AnnualTerm(1)
});
curl --request POST \
--url https://api.upodi.io/v2/subscriptions
Step 4 - Optionally update the amount of a given subscription charge
Once the subscription is created, the product plan acts as a template providing state of billing and quantity using the subscription charge elements. You can update the quantity of these as needed.
PUT https://api.upodi.io/v2/subscriptionCharges/{id}/setamount/ HTTP/1.1
{
"20"
}
UpodiService upodi = new UpodiService(ApiKey);
upodi.Subscriptions.SetAmount(
subscriptionId, // subscription id returned from step 3
5, // the new quantity
productPlanId // the given plan or charge id
);
curl --request PUT \
--url https://api.upodi.io/v2/subscriptions/id/setamount/
Step 5 - Activate the subscription to begin billing
Subscriptions remain in draft until activated, which alerts the billing engine to start processing the subscriptoin charges.
PUT https://api.upodi.io/v2/subscriptions/{id}/activate/ HTTP/1.1
UpodiService upodi = new UpodiService(ApiKey);
upodi.Subscriptions.Activate(subscriptionId);
curl --request PUT \
--url https://api.upodi.io/v2/subscriptions/id/activate/