Skip to main content

Stripe

Stripe is a suite of payment APIs that powers commerce for online businesses of all sizes, including fraud prevention, and subscription management. You can use Stripe to fetch commercial information (transactions, subscriptions ...) about your users who have an e-commerce business or use Stripe as a payment service provider.

This provider supports these data types:

Connect your Stripe account

To retrieve commerce data from companies using Stripe, you have to connect your Stripe account with Qard. To do that, you'll have to:

  1. Create a Stripe account if you already don't have one.
  2. Connect your account to Qard API using Stripe credentials (clientId & secretKey).
  3. Test your integration by creating a new synchronization using Stripe provider.

Create a new account:

info

If you already have an account, you can skip this part.

  1. Go to the Stripe register page and follow the instructions.
  2. Complete account ownership verification by providing as much information as you can.
  3. You will be contacted by Stripe at your email address within 1-3 business days.

Set up your Stripe account to use Connect feature:

  1. Go to the Stripe Connect page and follow the guide.
  2. After activating Connect feature, you'll have to update the settings page.
  3. Under Branding, you can customize how your business appears to your users by filling out your business details, uploading your company logo, and choosing your brand color.
  4. Click on Save branding changes button
  5. Under Integration, make sure to toggle OAuth for Standard accounts option.
  6. Click on Add URI button to set up Qard redirection URI: https://api.qardfinance.com/callback/stripe.
  7. Copy Client ID.
  8. Go to Stripe Developer Dashboard and copy your account Secret key.
  9. You are set to go !

Create your Stripe app

  1. Go to the Getting started with Stripe Apps page and follow the guide.
  2. Update stripe-app.json by adding the permissions. See here for details.
  3. Make the app distribution public and activate OAuth authentication by adding the allowed redirect URIs. Refer to the OAuth Authentication guide for assistance.
  4. Upload your app to Stripe using the command stripe apps upload.

1. Update Stripe provider credentials:

(PUT) /api/v6/providers/stripe/credentials
{
"credentials": {
"client_id": "STRIPE_CLIENT_ID",
"secret_key": "STRIPE_SECRET_KEY",
"type": "(APP|PLATFORM)"
}
}
info

The field type can take two values: APP or PLATFORM.

  • For APP: you need a Stripe application. See: Create your stripe-app
  • For PLATFORM: you need to configure your Stripe account to use Connect. See: Set up your Stripe account to use connect. Please be aware that the default platform account does not allow users to connect multiple platforms. Therefore, it is recommended to use APP.

2. Settings Stripe provider:

(PUT) /api/v6/providers/stripe/settings
{
"auto_connect": (true|false)
}

2. Enable Stripe provider:

(PUT) /api/v6/providers/stripe
{
"enable": true
}

Test Stripe integration:

You can test Stripe integration by creating a new data connection for your user.

(POST) /api/v6/users/{userId}/data-connections
{
"requested_data_types": [
"COMMERCE_BALANCE",
"COMMERCE_TRANSACTION",
"COMMERCE_DISPUTE",
"COMMERCE_SUBSCRIPTION",
"COMMERCE_PRODUCT",
"COMMERCE_TRANSACTION_INSIGHT",
"COMMERCE_SUBSCRIPTION_INSIGHT",
"COMMERCE_DISPUTE_INSIGHT"
],
"provider_name": "stripe"
}

After finishing the connecting process by your user, and after validating that the data connection status is CONNECTED, you can run a new synchronization.

(POST) /api/v6/users/{userId}/sync
{
"data_types": [
"COMMERCE_TRANSACTION",
"COMMERCE_DISPUTE",
"COMMERCE_BALANCE",
"COMMERCE_SUBSCRIPTION",
"COMMERCE_PRODUCT",
"COMMERCE_TRANSACTION_INSIGHT",
"COMMERCE_SUBSCRIPTION_INSIGHT",
"COMMERCE_DISPUTE_INSIGHT"
]
}

To verify that you are receiving your user's commerce data, check out these endpoints:

  • GET /api/v6/users/{userId}/commerce-balances
  • GET /api/v6/users/{userId}/commerce-disputes
  • GET /api/v6/users/{userId}/commerce-subscriptions
  • GET /api/v6/users/{userId}/commerce-transactions
  • GET /api/v6/users/{userId}/commerce-products
  • GET /api/v6/users/{userId}/commerce-transaction-insight
  • GET /api/v6/users/{userId}/commerce-subscription-insight
  • GET /api/v6/users/{userId}/commerce-dispute-insight

Stripe app JSON

{
"permissions": [
{
"permission": "connected_account_read",
"purpose": "Allows Qard to read connected_account."
},
{
"permission": "balance_read",
"purpose": "Allows Qard to read balance."
},
{
"permission": "balance_transaction_source_read",
"purpose": "Allows Qard to read balance_transaction_source."
},
{
"permission": "charge_read",
"purpose": "Allows Qard to read charge."
},
{
"permission": "customer_read",
"purpose": "Allows Qard to read customer."
},
{
"permission": "dispute_read",
"purpose": "Allows Qard to read dispute."
},
{
"permission": "invoice_read",
"purpose": "Allows Qard to read invoice."
},
{
"permission": "order_read",
"purpose": "Allows Qard to read order."
},
{
"permission": "payment_intent_read",
"purpose": "Allows Qard to read payment_intent."
},
{
"permission": "payment_links_read",
"purpose": "Allows Qard to read payment_links."
},
{
"permission": "payout_read",
"purpose": "Allows Qard to read payout."
},
{
"permission": "product_read",
"purpose": "Allows Qard to read product."
},
{
"permission": "subscription_read",
"purpose": "Allows Qard to read subscription."
},
{
"permission": "transfer_read",
"purpose": "Allows Qard to read transfer."
},
{
"permission": "plan_read",
"purpose": "Allows Qard to read plan."
}
],
"allowed_redirect_uris": [
"https://api.qardfinance.com/callback/stripe"
],
"stripe_api_access_type": "oauth",
"distribution_type": "public"
}