Auction Studio helps companies get paid, but it also helps them manage their customers. You can use Auction Studio to determine who has access to your product and who doesn't.
To successfully complete the tutorial, you need to do the following:
While Auction Studio provides a lot of information on which to base access to your product, we will demonstrate the simplest case: someone has overdue payments. Let's take, for example, a platform to request design work. You are charged based on the number of hours required for your project, and you are given 30 days to pay from the time the project is completed.
You can use the Getting Started Guide to set up a customer and understand how to create transactions throughout the project. When the project is completed, you will generate and issue the invoice.
Again, in this example, we only care if a customer is overdue on a payment. This means, they have waiting 31 or more days to pay their invoice. We don't want them to be able to post any more work until they have caught up on their billing.
The first thing we need to do is query for the customer and check that their overdue_amount
attribute isn't over 0. A couple things to note:
overdue_amount
.overdue_amount
may not be a single currency. It is effectively the sum of each overdue payment in "cents" (or the base unit of each currency). This makes it possible to check for overdue_amount > 0
.external_id
for our customer as demonstrated in the Getting Started GuideThe cURL version of the code simply retrieves the customer, while the other versions are more telling and provide more logic. We encourage you to view this page in a language other than cURL.
Paid.api_key = '{YOUR API KEY}' c = Paid::Customer.by_external_id(652) restrict_access = c.overdue_amount > 0 if restrict_access puts 'restrict access' else puts 'permit access' end
# Customer retrieval response #<Paid::Customer id=cus_DLjf9aDKE8ekdncz 0x00000a> JSON: { "id": "cus_DLjf9aDKE8ekdncz", "object": "customer", "name": "Awesome Customer", "email": "hello@paidlabs.com", "external_id": "652", "address_line1": "2261 Market Street", "address_line2": "#567", "address_city": "San Francisco", "address_state": "CA", "address_zip": "94114", "phone": "4155069330", "allow_ach": true, "allow_check": true, "allow_credit_card": true, "allow_wire": true, "terms": 30, "billing_type": "invoice", "billing_cycle": "monthly", "stripe_customer_id": null, "overdue_amount": 1264700 ... } # Output restrict access
Assuming you looked at an example other than cURL, you now have a variable access_control
which allows you to restrict access based on whether the customer is overdue.
You can use this new variable in any way (disallow login, redirect to payment page, trigger an email, etc.).
Should a customer be overdue, you can easily retrieve their overdue invoice and redirect them to it using the url
parameter of the invoice response object. This is a great way to display payment notifications within your own UI.