Stripe Views on Autonomous Database

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.

For more information on Stripe, see the Stripe website.

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.

To use Stripe API:
  1. Use the DBMS_NETWORK_ACL_ADMIN package to set Network ACL for accessing Stripe.
    BEGIN   
        DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
             host => 'stripe.com',
             ace  => xs$ace_type(privilege_list => xs$name_list('http'),
                                 principal_name => 'FOO',
                                 principal_type => xs_acl.ptype_db)
       );
    END;
    /
  2. 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;
  3. 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.
      BEGIN
          DBMS_CLOUD.CREATE_CREDENTIAL(
              credential_name => 'STRIPE$CRED',
              username        => 'STRIPE_TOKEN',
              password        => 'bearer_token' );
      END;
      /
    • (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';
  4. 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

STRIPE_ACCOUNTS View

STRIPE_ACCOUNTS lists the Stripe account information for the authenticated caller.

See Account for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the object.
OBJECT VARCHAR2(4000) String representing the objects type.
BUSINESS_TYPE VARCHAR2(4000) The business type.
BUSINESS_PROFILE CLOB Business information about the account.
CAPABILITIES CLOB A hash containing the set of capabilities that was requested for this account and their associated states.
CHARGES_ENABLED VARCHAR2(4000) Whether the account can create live charges.
COMPANY CLOB Information about the company or business.
CONTROLLER CLOB The controller of the account.
COUNTRY VARCHAR2(4000) The account country.
CREATED VARCHAR2(4000) Time at which the account was connected.
DEFAULT_CURRENCY VARCHAR2(4000) Three-letter ISO currency code representing the default currency for the account.
DETAILS_SUBMITTED VARCHAR2(4000) Whether account details have been submitted.

EMAIL

VARCHAR2(4000) An email address associated with the account.
EXTERNAL_ACCOUNTS CLOB External accounts currently attached to this account.
FUTURE_REQUIREMENTS VARCHAR2(4000) Information about the upcoming new requirements.
INDIVIDUAL

CLOB

Information about the person represented by the account.
METADATA

VARCHAR2(4000)

Set of key-value pairs that you can attach to an object.
PAYOUTS_ENABLED VARCHAR2(4000) Whether Stripe can send payouts to this account.
REQUIREMENTS CLOB Information about the requirements for the account.
SETTINGS CLOB Options for customizing how the account functions within Stripe.
TOS_ACCEPTANCE CLOB Details on the acceptance of the Stripe Services Agreement.
TYPE VARCHAR2(4000) The Stripe account type.

STRIPE_COUPONS View

STRIPE_COUPONS lists the coupons issued in the Stripe account.

See Discounts for subscriptions for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the object.
OBJECT VARCHAR2(4000) String representing the object type.
AMOUNT_OFF NUMBER Amount that will be taken off the subtotal of any invoices for this customer.
CREATED VARCHAR2(4000) Time at which the object was created.
CURRENCY VARCHAR2(4000) If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.
DURATION VARCHAR2(4000) Describes how long a customer who applies this coupon will get the discount.
DURATION_IN_MONTHS NUMBER If duration is repeating, the number of months the coupon applies.
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.
MAX_REDEMPTIONS NUMBER Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
METADATA CLOB Set of key-value pairs that you can attach to an object.
NAME VARCHAR2(4000) Name of the coupon displayed to customers on for instance invoices or receipts.
PERCENT_OFF NUMBER Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.
REDEEM_BY VARCHAR2(4000) Date after which the coupon can no longer be redeemed.
TIMES_REDEEMED NUMBER Number of times this coupon has been applied to a customer.
VALID VARCHAR2(4000) Taking account of the above properties, whether this coupon can still be applied to a customer.

STRIPE_CUSTOMERS View

STRIPE_CUSTOMERS lists the customers defined in the Stripe account.

See Customers for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the customer.
OBJECT VARCHAR2(4000) String representing the object type.
ADDRESS CLOB The customers address.
BALANCE NUMBER Current balance, if any, being stored on the customer.
CREATED VARCHAR2(4000) Time at which the object was created.
CURRENCY VARCHAR2(4000) Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes.
DEFAULT_SOURCE VARCHAR2(4000) ID of the default payment source for the customer.
DELETED VARCHAR2(4000) True if the customer is marked as deleted.
DELINQUENT VARCHAR2(4000) When the customers latest invoice is billed by charging automatically, delinquent is true if the invoices latest charge failed.
DESCRIPTION VARCHAR2(4000) An arbitrary string attached to the object.
DISCOUNT CLOB Describes the current discount active on the customer, if there is one.
EMAIL VARCHAR2(4000) The customer email address.
INVOICE_PREFIX VARCHAR2(4000) The prefix for the customer used to generate unique invoice numbers.
INVOICE_SETTINGS CLOB The customer default invoice settings.
LIVEMODE VARCHAR2(4000) Has the value true if the object exists in live mode or then value false if the object exists in test mode.
METADATA CLOB Set of key-value pairs that you can attach to an object.
NAME VARCHAR2(4000) The customer full name or business name.
NEXT_INVOICE_SEQUENCE NUMBER The suffix of the customers next invoice number.
PHONE VARCHAR2(4000) The customers phone number.
PREFERRED_LOCALES CLOB The customers preferred locales, ordered by preference.
SHIPPING CLOB Mailing and shipping address for the customer.
TAX_EXEMPT VARCHAR2(4000) Describes the customers tax exemption status.
TAX_IDS CLOB The customer tax IDs.
TEST_CLOCK CLOB ID of the test clock this customer belongs to.

STRIPE_INVOICES View

STRIPE_INVOICES lists the invoices defined in the Stripe account.

See Invoicing for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the object
OBJECT VARCHAR2(4000) String representing the objects type.
ACCOUNT_COUNTRY VARCHAR2(4000) The country of the business associated with this invoice.
ACCOUNT_NAME VARCHAR2(4000) The public name of the business associated with this invoice.
ACCOUNT_TAX_IDS CLOB The account tax IDs associated with the invoice.
AMOUNT_DUE NUMBER Final amount due at this time for this invoice.
AMOUNT_PAID NUMBER The amount, in cents, that was paid.
AMOUNT_REMAINING NUMBER The difference between amount_due and amount_paid, in cents.
AMOUNT_SHIPPING NUMBER This is the sum of all the shipping amounts.
APPLICATION VARCHAR2(4000) ID of the Connect Application that created the invoice.
APPLICATION_FEE_AMOUNT NUMBER The fee in cents that will be applied to the invoice and transferred to the application owners Stripe account when the invoice is paid.
ATTEMPT_COUNT NUMBER Number of payment attempts made for this invoice, from the perspective of the payment retry schedule.
ATTEMPTED VARCHAR2(4000) Whether an attempt has been made to pay the invoice.
AUTO_ADVANCE VARCHAR2(4000) Controls whether Stripe will perform automatic collection of the invoice.
AUTOMATIC_TAX CLOB Settings and latest results for automatic tax lookup for this invoice.
BILLING_REASON VARCHAR2(4000) Indicates the reason why the invoice was created.
CHARGE CLOB ID of the latest charge generated for this invoice, if any.
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.
CUSTOM_FIELDS CLOB Custom fields displayed on the invoice.
CUSTOMER VARCHAR2(4000) The ID of the customer who will be billed.
CUSTOMER_ADDRESS CLOB The customers address.
CUSTOMER_EMAIL VARCHAR2(4000) The customers email.
CUSTOMER_NAME VARCHAR2(4000) The customers name.
CUSTOMER_PHONE VARCHAR2(4000) The customers phone number.
CUSTOMER_SHIPPING CLOB The customers shipping information.
CUSTOMER_TAX_EXEMPT VARCHAR2(4000) The customers tax exempt status.
CUSTOMER_TAX_IDS CLOB The customers tax IDs.
DEFAULT_PAYMENT_METHOD VARCHAR2(4000) ID of the default payment method for the invoice.
DEFAULT_SOURCE VARCHAR2(4000) ID of the default payment source for the invoice.
DEFAULT_TAX_RATES CLOB The tax rates applied to this invoice, if any.
DESCRIPTION VARCHAR2(4000) An arbitrary string attached to the object.
DISCOUNT CLOB Describes the current discount applied to this invoice, if there is one.
DISCOUNTS CLOB The discounts applied to the invoice.
DUE_DATE VARCHAR2(4000) The date on which payment for this invoice is due.
ENDING_BALANCE NUMBER Ending customer balance after the invoice is finalized.
FOOTER VARCHAR2(4000) Footer displayed on the invoice.
FROM_INVOICE VARCHAR2(4000) Details of the invoice that was cloned.
HOSTED_INVOICE_URL VARCHAR2(4000) The URL for the hosted invoice page.
INVOICE_PDF VARCHAR2(4000) The link to download the PDF for the invoice.
LAST_FINALIZATION_ERROR CLOB The error encountered during the previous attempt to finalize the invoice.
LATEST_REVISION VARCHAR2(4000) The ID of the most recent non-draft revision of this invoice.
LINES CLOB The individual line items that make up the invoice.
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_PAYMENT_ATTEMPT VARCHAR2(4000) The time at which payment will next be attempted.
NUMBER_ VARCHAR2(4000) A unique, identifying string that appears on emails sent to the customer for this invoice.
ON_BEHALF_OF VARCHAR2(4000) The account (if any) for which the funds of the invoice payment are intended.
PAID VARCHAR2(4000) Whether payment was successfully collected for this invoice.
PAID_OUT_OF_BAND VARCHAR2(4000) Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.
PAYMENT_INTENT CLOB The PaymentIntent associated with this invoice.
PAYMENT_SETTINGS CLOB Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
PERIOD_END VARCHAR2(4000) End of the usage period during which invoice items were added to this invoice.
PERIOD_START VARCHAR2(4000) Start of the usage period during which invoice items were added to this invoice.
POST_PAYMENT_CREDIT_NOTES_AMOUNT NUMBER Total amount of all post-payment credit notes issued for this invoice.
PRE_PAYMENT_CREDIT_NOTES_AMOUNT NUMBER Total amount of all pre-payment credit notes issued for this invoice.
QUOTE VARCHAR2(4000) The quote this invoice was generated from.
RECEIPT_NUMBER VARCHAR2(4000) This is the transaction number that appears on email receipts sent for this invoice.
RENDERING_OPTIONS CLOB Options for invoice PDF rendering.
SHIPPING_COST CLOB The details of the cost of shipping, including the ShippingRate applied on the invoice.
SHIPPING_DETAILS CLOB Shipping details for the invoice.
STARTING_BALANCE NUMBER Starting customer balance before the invoice is finalized.
STATEMENT_DESCRIPTOR VARCHAR2(4000) Extra information about an invoice for the customers credit card statement.
STATUS VARCHAR2(4000) The status of the invoice, one of draft, open, paid, uncollectible, or void.
STATUS_TRANSITIONS CLOB The timestamps at which the invoice status was updated.
SUBSCRIPTION VARCHAR2(4000) The subscription that this invoice was prepared for, if any.
SUBTOTAL NUMBER Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied.
SUBTOTAL_EXCLUDING_TAX NUMBER The integer amount in cents representing the subtotal of the invoice before any invoice level discount or tax is applied.
TAX NUMBER The amount of tax on this invoice.
THRESHOLD_REASON CLOB If billing_reason is set to subscription_threshold this returns more information on which threshold rules triggered the invoice.
TEST_CLOCK VARCHAR2(4000) ID of the test clock this invoice belongs to.
TOTAL NUMBER Total after discounts and taxes.
TOTAL_DISCOUNT_AMOUNTS CLOB The aggregate amounts calculated per discount across all line items.
TOTAL_EXCLUDING_TAX NUMBER The integer amount in cents representing the total amount of the invoice including all discounts but excluding all tax.
TOTAL_TAX_AMOUNTS CLOB The aggregate amounts calculated per tax rate for all line items.
TRANSFER_DATA CLOB The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.
WEBHOOKS_DELIVERED_AT VARCHAR2(4000) This field tracks the time when webhooks for this invoice were successfully delivered.

STRIPE_PLANS View

STRIPE_PLANS lists the pricing plans defined in the Stripe account.

See Plans for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the plan.
OBJECT VARCHAR2(4000) String representing the object type.
ACTIVE VARCHAR2(4000) Whether the plan is currently available for purchase.
AGGREGATE_USAGE VARCHAR2(4000) Specifies a usage aggregation strategy for plans of usage_type=metered.
AMOUNT NUMBER The unit amount in cents to be charged, represented as a whole integer.
AMOUNT_DECIMAL VARCHAR2(4000) The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
BILLING_SCHEME VARCHAR2(4000) Describes how to compute the price per period.
CREATED VARCHAR2(4000) Time at which the plan was created.
CURRENCY VARCHAR2(4000) Three-letter ISO currency code, in lowercase.
DELETED VARCHAR2(4000) True if the plan is marked as deleted.
INTERVAL VARCHAR2(4000) The frequency at which a subscription is billed.
INTERVAL_COUNT NUMBER The number of intervals between subscription billings.
LIVEMODE VARCHAR2(4000) Has the value true if the plan exists in live mode or the value false if the plan exists in test mode.
METADATA CLOB Set of key-value pairs that you can attach to an plan.
NICKNAME VARCHAR2(4000) A brief description of the plan, hidden from customers.
PRODUCT VARCHAR2(4000) ID of the product whose pricing this plan determines.
TIERS CLOB Each element represents a pricing tier.
TIERS_MODE VARCHAR2(4000) Defines if the tiering price should be graduated or volume based.
TRANSFORM_USAGE CLOB Apply a transformation to the reported usage or set quantity before computing the amount billed.
TRIAL_PERIOD_DAYS NUMBER Default number of trial days when subscribing a customer to this plan using trial_from_plan=true.
USAGE_TYPE VARCHAR2(4000) Configures how the quantity per period should be determined.

STRIPE_PRODUCTS View

STRIPE_PRODUCTS lists the query information about products defined in the Stripe account.

See Manage products and prices for additional information.
Column Datatype Description
ID VARCHAR2(4000) Unique identifier for the object.
OBJECT VARCHAR2(4000) String representing the object type.
ACTIVE VARCHAR2(4000) Whether the product is currently available for purchase.
CREATED VARCHAR2(4000) Time at which the object was created.
DEFAULT_PRICE VARCHAR2(4000) The ID of the Price object that is the default price for this product.
DESCRIPTION VARCHAR2(4000) The product description, meant to be displayable to the customer.
IMAGES CLOB A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
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.
NAME VARCHAR2(4000) The product name, meant to be displayable to the customer.
PACKAGE_DIMENSIONS CLOB The dimensions of this product for shipping purposes.
SHIPPABLE VARCHAR2(4000) Whether this product is shipped.
STATEMENT_DESCRIPTOR VARCHAR2(4000) Extra information about a product which will appear on your customers credit card statement.
TAX_CODE VARCHAR2(4000) A tax code ID.
UNIT_LABEL VARCHAR2(4000) A label that represents units of this product.
UPDATED VARCHAR2(4000) Time at which the object was last updated.
URL VARCHAR2(4000) A URL of a publicly-accessible webpage for this product.

STRIPE_SUBSCRIPTIONS View

STRIPE_SUBSCRIPTIONS lists the subscriptions managed in the Stripe account.

See Subscriptions for additional information.
Column Datatype Subscription
ID VARCHAR2(4000) Unique identifier for the object.
OBJECT VARCHAR2(4000) String representing the object type.
APPLICATION VARCHAR2(4000) 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.