Skip to main content

Paypal

PayPal is an online payment platform that facilitates payments between parties through online transfers. You can use Paypal to fetch commercial information (transactions, subscriptions ...) about your users who have an e-commerce business or use Paypal as a payment service provider.

This provider supports these data types:

Connect your Paypal account

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

  1. Create a Paypal account if you already don't have one and register as a Third Party Provider (TPP).
  2. Connect your account to Qard API using Paypal credentials (clientId & clientSecret).
  3. Test your integration by creating a new synchronization using Paypal provider.

Create a new account:

  1. Go to the Paypal register page and follow the instructions.
  2. After that, you can go to the https://www.paypal.com/partnerexp/tppLanding/ and register as a Third Party Provider (TPP) for PayPal’s X2SA API
  3. Enter Qard callback URI (https://api.qardfinance.com/callback/paypal) in the "Your return URL" field.
  4. After Submitting the form, your credentials (clientId and clientSecret) will be available to download.
info

The API's credentials will only be activated once Paypal has verified your TPP license and confirmed your registration. Paypal will send you an email when you can start using the API. In the meantime, you can start testing by using sandbox's credentials.

1. Update Paypal provider credentials:

  • is_sandbox: The type of the account (sandbox or live)
  • client_id: Application client ID
  • client_secret: Application client secret
(PUT) /api/v6/providers/paypal/credentials
{
"credentials": {
"is_sandbox": (true|false),
"client_id": "PAYPAL_CLIENT_ID",
"client_secret": "PAYPAL_SECRET_KEY"
}
}

2. Settings Paypal provider:

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

3. Enable Paypal provider:

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

Test Paypal integration:

You can test Paypal 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": "paypal"
}

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