Stripe is an online payment processing and credit card processing platform for businesses. Users can query views created on top of Stripe APIs using the DBMS_CLOUD package to get Stripe information such as invoices, subscriptions, and customers.
Prerequisites to Use Stripe Views To use Stripe with Autonomous Database, set Network ACL for accessing Stripe and create a credential that allows access to Stripe.
STRIPE_ACCOUNTS View STRIPE_ACCOUNTS lists the Stripe account information for the authenticated caller.
STRIPE_COUPONS View STRIPE_COUPONS lists the coupons issued in the Stripe account.
STRIPE_CUSTOMERS View STRIPE_CUSTOMERS lists the customers defined in the Stripe account.
STRIPE_INVOICES View STRIPE_INVOICES lists the invoices defined in the Stripe account.
STRIPE_PLANS View STRIPE_PLANS lists the pricing plans defined in the Stripe account.
STRIPE_PRODUCTS View STRIPE_PRODUCTS lists the query information about products defined in the Stripe account.
STRIPE_SUBSCRIPTIONS View STRIPE_SUBSCRIPTIONS lists the subscriptions managed in the Stripe account.
Only an ADMIN has access to the Stripe Views. A user must be granted READ access to use them.
For Example:
GRANT READ on STRIPE_COUPONS to TYLER;
Create a Credential for Stripe APIs. There are two ways to perform this task:
(Option 1: Create a credential object with the name STRIPE$CRED.) The username is STRIPE_TOKEN and the password is the Stripe API token. This token can be found in the Stripe Developers Dashboard. See Stripe API keys for additional information.
(Option 2: Create a credential object with a user defined name.) The username is STRIPE_TOKEN and the password is the Stripe API token. This token can be found in the Stripe Developers Dashboard. Before selecting from the Stripe Views, the Session parameter DEFAULT_CREDENTIAL should be set using the owner and credential object name. See Stripe API keys for additional information.
BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'MY_STRIPE_CRED',
username => 'STRIPE_TOKEN',
password => 'bearer_token');
END;
/
ALTER SESSION SET default_credential = 'MY_SCHEMA.MY_STRIPE_CRED';
Test by querying a Stripe View:
SELECT name, percent_off, duration, times_redeemed FROM STRIPE_COUPONS;
NAME PERCENT_OFF DURATION TIMES_REDEEMED
--------------- ------------- --------------- --------------
Promotion Feb 10.00 once 0
Seasonal disc 5.00 once 0
Firstpurchase 5.00 forever 1
ID of the Connect Application that created the subscription.
APPLICATION_FEE_PERCENT
NUMBER
A non-negative decimal between 0 and 100, with at most two decimal places.
AUTOMATIC_TAX
CLOB
Automatic tax settings for this subscription.
BILLING_CYCLE_ANCHOR
VARCHAR2(4000)
Determines the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices.
BILLING_THRESHOLDS
CLOB
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
CANCEL_AT
VARCHAR2(4000)
A date in the future at which the subscription will automatically get canceled.
CANCEL_AT_PERIOD_END
VARCHAR2(4000)
If the subscription has been canceled with the at_period_end flag set to true, cancel_at_period_end on the subscription will be true.
CANCELED_AT
VARCHAR2(4000)
If the subscription has been canceled, the date of that cancellation.
COLLECTION_METHOD
VARCHAR2(4000)
Either charge_automatically, or send_invoice.
CREATED
VARCHAR2(4000)
Time at which the object was created.
CURRENCY
VARCHAR2(4000)
Three-letter ISO currency code, in lowercase.
CURRENT_PERIOD_END
VARCHAR2(4000)
End of the current period that the subscription has been invoiced for.
CURRENT_PERIOD_START
VARCHAR2(4000)
Start of the current period that the subscription has been invoiced for.
CUSTOMER
VARCHAR2(4000)
ID of the customer who owns the subscription.
DAYS_UNTIL_DUE
NUMBER
Number of days a customer has to pay invoices generated by this subscription.
DEFAULT_PAYMENT_METHOD
VARCHAR2(4000)
ID of the default payment method for the subscription.
DEFAULT_SOURCE
VARCHAR2(4000)
ID of the default payment source for the subscription.
DEFAULT_TAX_RATES
CLOB
The tax rates that will apply to any subscription item that does not have tax_rates set.
DESCRIPTION
VARCHAR2(4000)
The subscription description, meant to be displayable to the customer.
DISCOUNT
CLOB
Describes the current discount applied to this subscription, if there is one.
ENDED_AT
VARCHAR2(4000)
If the subscription has ended, the date the subscription ended.
ITEMS
CLOB
List of subscription items, each with an attached price.
LATEST_INVOICE
VARCHAR2(4000)
The most recent invoice this subscription has generated.
LIVEMODE
VARCHAR2(4000)
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
METADATA
CLOB
Set of key-value pairs that you can attach to an object.
NEXT_PENDING_INVOICE_ITEM_INVOICE
VARCHAR2(4000)
Specifies the approximate timestamp on which any pending invoice items will be billed acc to the schedule provided at pending_invoice_item_interval.
ON_BEHALF_OF
VARCHAR2(4000)
The account the charge was made on behalf of for charges associated with this subscription.
PAUSE_COLLECTION
CLOB
If specified, payment collection for this subscription will be paused.
PAYMENT_SETTINGS
VARCHAR2(4000)
Payment settings passed on to invoices created by the subscription.
PENDING_INVOICE_ITEM_INTERVAL
CLOB
Specifies an interval for how often to bill for any pending invoice items.
PENDING_SETUP_INTENT
VARCHAR2(4000)
For collecting user authentication when creating a subscription without immediate payment or updating a subscriptions payment method, allowing you to optimize for off-session payments.
PENDING_UPDATE
CLOB
If specified, pending updates that will be applied to the subscription once the latest_invoice has been paid.
SCHEDULE
CLOB
The schedule attached to the subscription.
START_DATE
VARCHAR2(4000)
Date when the subscription was first created.
STATUS
VARCHAR2(4000)
Possible values are incomplete, incomplete_expired, trialing, active, past_due, canceled, or unpaid.
TEST_CLOCK
VARCHAR2(4000)
ID of the test clock this subscription belongs to.
TRANSFER_DATA
CLOB
The account the subscriptions payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscriptions invoices.
TRIAL_END
VARCHAR2(4000)
If the subscription has a trial, the end of that trial.
TRIAL_SETTINGS
VARCHAR2(4000)
Settings related to subscription trials.
TRIAL_START
VARCHAR2(4000)
If the subscription has a trial, the beginning of that trial.