Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new stripe guide #371

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions docs/guides/process/backup-stripe-tokens.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
toc_max_heading_level: 2
---

import GettingStartedSection from "@site/src/components/docs/_getting-started-section.mdx";
import { Alert, Alerts } from "@site/src/components/shared/Alert";
import { Enterprise } from "@site/src/components/shared/Enterprise";


# Backup Your Stripe Tokens

In the ever-evolving world of online transactions, prioritizing innovation and operational efficiency is becoming critical to organizational payment divisions. This is even more true with the potential for sudden Stripe account terminations, the need for scalable payment processing solutions beyond a single provider, and other payment services to drive new revenue and cost savings. In some cases, merchants and platforms with a multiprocessor payment ecosystem must create a unified wallet system or single source of truth for consumer profiles.

This guide explores using the Stripe Forwarding API in tandem with Basis Theory's secure Vault to open access to card data and enable new opportunities without making any changes to your existing Stripe integration.

![Forward Cards from Stripe](/img/guides/cards/stripe-forward-cards.png)

## Getting Started

<GettingStartedSection />

### Request Access to Stripe Forwarding API

[Click here to create](https://dashboard.stripe.com/login?redirect=https://support.stripe.com%2Fcontact%2Femail%3Fquestion%3Dother%26topic%3Dpayment_apis%26subject%3DI%20need%20access%20to%20the%20Vault%20and%20Forward%20API%26body%3DHi%20Stripe%20team.%20I%20would%20like%20to%20request%20access%20to%20the%20Vault%20and%20Forward%20API%20to%20store%20payment%20method%20details%20with%20my%20own%20token%20vault%2C%20outsourced%20by%20Basis%20Theory%2C%20Inc.%20Please%20find%20their%20PCI%20Attestation%20of%20Compliance%20attached.%20The%20target%20endpoint%20is%20https%3A%2F%2Fapi.basistheory.com%2Ftokens) a Stripe support request following this template:

```text
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a template to make easy to copy paste for folks that don't like clicking links. I could replace this with a picture if it is considered better.

image

Account
Select your Stripe account

What do you need help with?
Payment APIs

What is your question?
I need access to the Vault and Forward API

Tell us more — how can we help?
I would like to request access to the Vault and Forward API
to store payment method details with my own token vault,
outsourced by Basis Theory. Please find their PCI Attestation of Compliance attached.
The target endpoint is https://api.basistheory.com/tokens
```

Make sure to attach [Basis Theory PCI DSS Attestation of Compliance](https://trust.basistheory.com/?itemUid=53e1508c-665e-45a8-9ce0-03fdf9ae1efb&source=click) to your request.

If you need help with this step, or anytime along the way, don't hesitate to [reach out to us](https://basistheory.com/contact?how_can_we_help_=I+need+help+vaulting+my+Stripe+tokens).

### Creating a Public Application

Next you will need a [Public Application](/docs/api/applications) using our PCI-compliant template `Collect PCI Data`. [Click here to create one.](https://portal.basistheory.com/applications/create?application_template_id=db9148c1-a55f-4164-b830-a20ab6d720ae)

This will create an application with the following [Access Controls](/docs/concepts/access-controls):
* Permissions: `token:create`, `token:update`
* Containers: `/pci/`
* Transform: `mask`

<Alert>Save the API Key from the created Public Application as it will be used later in this guide.</Alert>

## Vaulting Cards

Once you are granted access to the Stripe's Forwarding API and created the Basis Theory Public API Key, choose your favorite HTTP Client for your server-side language and call the forwarding endpoint:

```shell showLineNumbers title="Vault a Card"
curl --location 'https://api.stripe.com/v1/forwarding/requests' \
--header 'Content-Type: application/x-www-form-urlencoded' \
// highlight-next-line
--header 'Authorization: Bearer <STRIPE_API_KEY>' \
// highlight-next-line
--data-urlencode 'payment_method=<STRIPE_PAYMENT_METHOD_ID>' \
--data-urlencode 'url=https://api.basistheory.com/tokens' \
--data-urlencode 'request[headers][0][name]=BT-API-KEY' \
// highlight-next-line
--data-urlencode 'request[headers][0][value]=<BT_API_KEY>' \
// highlight-next-line
--data-urlencode 'request[body]={"type": "card", "data": { "id": "<STRIPE_PAYMENT_METHOD_ID>", "number": "", "expiration_month": "", "expiration_year": "", "cvc": "" }, "metadata": { "cardholder_name": "" } }' \
--data-urlencode 'replacements[0]=card_number' \
--data-urlencode 'replacements[1]=card_expiry' \
--data-urlencode 'replacements[2]=card_cvc'\
--data-urlencode 'replacements[3]=cardholder_name'
```

<Alert>Make sure to replace the Stripe API Key, Payment Method Identified (twice) and Basis Theory API Key.</Alert>

You should [receive a response](https://docs.stripe.com/api/forwarding/forwarding_requests/create) containing a new Basis Theory token aliased to the Stripe token. This means the credit card data is backed up in Basis Theory Vault using the same Payment Method identifier by Stripe.

## Keeping Cards In Sync <Enterprise />

Saved Stripe payment methods can receive updates from Networks when consumers receive new cards (e.g. replacing stolen, lost or expired cards). When an update to a payment method happens, Stripe fires [webhooks](https://docs.stripe.com/payments/cards/overview#automatic-card-updates) which can be leveraged to also update your Basis Theory Vault.

1. Setup Stripe webhooks for `payment_method.updated` and `payment_method.automatically_updated` events, following their [documentation](https://docs.stripe.com/webhooks).
2. When any of those are fired and hits your endpoints, initiate a forward request (see request example above) to Stripe in order to update the existing Basis Theory token.

If you are interested in using Stripe's Account Updater in combination with Basis Theory Vault, [let's talk](https://basistheory.com/contact?how_can_we_help_=I+want+to+learn+more+about+using+Stripe+Card+Account+Updater+with+Basis+Theory+vault).

Alternatively, you can leverage [Basis Theory Account Updater](/docs/features/account-updater) to have a single source of truth for the latest and greatest card information, while keeping multiple Payment Processors tokens up-to-date, including Stripe.
108 changes: 14 additions & 94 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const sidebars = {
enterprise: true,
},
},
"guides/process/backup-stripe-tokens",
],
},
{
Expand All @@ -75,10 +76,7 @@ const sidebars = {
dark: "/img/sidebar/dark/bank.svg",
},
},
items: [
"guides/banks/collect-bank-accounts",
"guides/banks/process-bank-payments",
],
items: ["guides/banks/collect-bank-accounts", "guides/banks/process-bank-payments"],
},
{
type: "category",
Expand Down Expand Up @@ -124,24 +122,7 @@ const sidebars = {
type: "doc",
id: "guides/any/index",
},
items: [
"guides/collect/collect-data-from-web",
"guides/collect/collect-data-with-react",
"guides/collect/collect-data-with-android",
"guides/collect/collect-data-with-ios",
"guides/collect/collect-data-with-react-native-on-ios",
"guides/collect/collect-inbound-sensitive-data",
"guides/collect/customize-web-form",
"guides/share/send-data-to-third-party",
"guides/share/display-masked-data",
"guides/share/reveal-tokenized-data",
"guides/share/reveal-data-from-third-party",
"guides/process/search-data",
"guides/process/analyze-data",
"guides/govern/control-data-access",
"guides/govern/audit-data-access",
"guides/govern/sessions",
],
items: ["guides/collect/collect-data-from-web", "guides/collect/collect-data-with-react", "guides/collect/collect-data-with-android", "guides/collect/collect-data-with-ios", "guides/collect/collect-data-with-react-native-on-ios", "guides/collect/collect-inbound-sensitive-data", "guides/collect/customize-web-form", "guides/share/send-data-to-third-party", "guides/share/display-masked-data", "guides/share/reveal-tokenized-data", "guides/share/reveal-data-from-third-party", "guides/process/search-data", "guides/process/analyze-data", "guides/govern/control-data-access", "guides/govern/audit-data-access", "guides/govern/sessions"],
},
{
type: "html",
Expand All @@ -160,13 +141,7 @@ const sidebars = {
type: "doc",
id: "features/index",
},
items: [
"features/account-updater",
"features/global-data",
"features/network-tokens",
"features/3d-secure",
"features/anti-fraud",
],
items: ["features/account-updater", "features/global-data", "features/network-tokens", "features/3d-secure", "features/anti-fraud"],
},
{
type: "category",
Expand Down Expand Up @@ -210,14 +185,7 @@ const sidebars = {
type: "doc",
id: "expressions/index",
},
items: [
"expressions/filters",
"expressions/detokenization",
"expressions/aliasing",
"expressions/fingerprints",
"expressions/masks",
"expressions/search-indexes",
],
items: ["expressions/filters", "expressions/detokenization", "expressions/aliasing", "expressions/fingerprints", "expressions/masks", "expressions/search-indexes"],
},
{
type: "category",
Expand Down Expand Up @@ -268,10 +236,7 @@ const sidebars = {
type: "doc",
id: "blueprints/cards/index",
},
items: [
"blueprints/cards/collect-and-process-cards",
"blueprints/cards/issue-and-display-cards",
],
items: ["blueprints/cards/collect-and-process-cards", "blueprints/cards/issue-and-display-cards"],
},
{
type: "category",
Expand Down Expand Up @@ -341,17 +306,7 @@ const sidebars = {
type: "doc",
id: "api/index",
},
items: [
"api/index",
"api/authentication",
"api/request-correlation",
"api/pagination",
"api/errors",
"api/ip-addresses",
"api/rate-limits",
"api/idempotency",
"api/testing",
],
items: ["api/index", "api/authentication", "api/request-correlation", "api/pagination", "api/errors", "api/ip-addresses", "api/rate-limits", "api/idempotency", "api/testing"],
},
{
type: "category",
Expand All @@ -360,13 +315,7 @@ const sidebars = {
type: "doc",
id: "api/applications/applications",
},
items: [
"api/applications/applications",
"api/applications/access-rules",
"api/applications/application-keys",
"api/applications/permissions",
"api/applications/sessions",
],
items: ["api/applications/applications", "api/applications/access-rules", "api/applications/application-keys", "api/applications/permissions", "api/applications/sessions"],
},
"api/logs",
{
Expand All @@ -376,12 +325,7 @@ const sidebars = {
type: "doc",
id: "api/proxies/proxies",
},
items: [
"api/proxies/proxies",
"api/proxies/ephemeral-proxy",
"api/proxies/pre-configured-proxies",
"api/proxies/proxy-errors",
],
items: ["api/proxies/proxies", "api/proxies/ephemeral-proxy", "api/proxies/pre-configured-proxies", "api/proxies/proxy-errors"],
},
{
type: "category",
Expand Down Expand Up @@ -516,13 +460,7 @@ const sidebars = {
type: "doc",
id: "sdks/web/javascript/index",
},
items: [
"sdks/web/javascript/types",
"sdks/web/javascript/options",
"sdks/web/javascript/lifecycle",
"sdks/web/javascript/events",
"sdks/web/javascript/services",
],
items: ["sdks/web/javascript/types", "sdks/web/javascript/options", "sdks/web/javascript/lifecycle", "sdks/web/javascript/events", "sdks/web/javascript/services"],
},
{
type: "category",
Expand All @@ -531,12 +469,7 @@ const sidebars = {
type: "doc",
id: "sdks/web/react/index",
},
items: [
"sdks/web/react/components",
"sdks/web/react/events",
"sdks/web/react/properties",
"sdks/web/react/services",
],
items: ["sdks/web/react/components", "sdks/web/react/events", "sdks/web/react/properties", "sdks/web/react/services"],
},
{
type: "category",
Expand All @@ -563,12 +496,7 @@ const sidebars = {
type: "doc",
id: "sdks/mobile/android/index",
},
items: [
"sdks/mobile/android/types",
"sdks/mobile/android/options",
"sdks/mobile/android/events",
"sdks/mobile/android/services",
],
items: ["sdks/mobile/android/types", "sdks/mobile/android/options", "sdks/mobile/android/events", "sdks/mobile/android/services"],
},
{
type: "category",
Expand All @@ -577,12 +505,7 @@ const sidebars = {
type: "doc",
id: "sdks/mobile/ios/index",
},
items: [
"sdks/mobile/ios/types",
"sdks/mobile/ios/options",
"sdks/mobile/ios/events",
"sdks/mobile/ios/services",
],
items: ["sdks/mobile/ios/types", "sdks/mobile/ios/options", "sdks/mobile/ios/events", "sdks/mobile/ios/services"],
},
{
type: "category",
Expand All @@ -591,10 +514,7 @@ const sidebars = {
type: "doc",
id: "sdks/mobile/react-native/index",
},
items: [
"sdks/mobile/react-native/components",
"sdks/mobile/react-native/services",
],
items: ["sdks/mobile/react-native/components", "sdks/mobile/react-native/services"],
},
],
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading