Implementation marketplace using Stripe or PayPal
Definition
Marketplace
– type of business model of Internet application, which provides service for
sellers to sell products directly in application, and application will capture
and charge buyer using payment provider systems. It is possible for a
marketplace application to take platform fees.
Overview
There are
different platforms which allow to implement marketplace functionality. Most commonly
used are PayPal
Marketplace and Stripe Connect,
also recently become popular Adyen.
Only PayPal and Stripe was investigated.
All of the
have developer’s sandboxes. Paypal has separate one, Stripe included into a
real account (You have to enable test data, just toggle “View test data”).
Settings
Stripe
To be able
to work with Stripe application should have Publishable key and Secret
key and Client id / Test mode client
id.
Publishable
key and secret key you can found under Developers
-> API keys.
Client Id
is received from an account manager. Test mode client id can be found under Connect -> Settings.
Paypal
Go to PayPal Developer
dashboard, here under REST API apps press Create App button. After filling a form, you will see API credentials
PayPal Account / Sandbox Account and
Client ID. Secret is hidden under Client ID press “Show” to reveal it. If
you build test application, you have to create test users in the PayPal
console.
Logic
A logic is
common for two payments platforms. Using a web form customer is redirected to a
payment platform site (client id should be provider in redirecting URL).
Customer has to agree with a payment. Payment platform redirect customer back
on the marketplace site (redirect URL should be registered by site admin in a
payment platform). There should be two types of redirects: success and error.
Payment
platform provides marketplace with a payment token, with should be used to
create a charge.
Using available
libraries site has to create a Charge. It
is possible to delay capture, by setting capture to false on charge object. In
this case capture should be done later.
To be able
to process payments on behalf of sellers’ marketplace has to register connected
seller in a payment platform. This is done placing a link on a site, redirecting
to a payment platform when seller agree to allow a marketplace take payment on
his/her behalf.
Packages used
Paypal
com.paypal.sdk:adaptivepaymentssdk:2.9.117
com.paypal.sdk:rest-api-sdk
Stripe
com.stripe:stripe-java:5.36.0
Important: Paypal does not allow to modify a
charge, except you are using Adaptive Payments API. The only problem with it is
to test it you have to have business account, cause in other case usage of API
is forbidden.
Comments
Post a Comment