Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Stripe Recipes Building On Demand Apps In Php

What Basically Is On Demand Apps:

On-demand apps provide services to your customer using contractors, who are paid through your
platform.

For some businesses, the platform’s brand is at the center of the commerce: they aren’t just
providing a software platform, they’re providing an end-to-end experience. For example, consider
an on-demand app: Rates are set by the platform. Although a third party is providing the specific
service, the platform is managing the experience, guaranteeing the quality, and handling the
customer service.

First, understand when you are creating the on-demand app you need to create Custom accounts on behalf of your service provider. One of the most important considerations with Custom accounts is that you are entirely responsible for providing the necessary information about your contractors, as Stripe will never interact with them it is you who will. This means you must.

  • Address all necessary identity verification.
  • Establish the contractor’s bank account for payouts.
  • Have your contractor agree to your terms and services.

Steps To Follow To Implement On Demand App:

Step: 1

First, you have to download the latest stripe library for PHP. Currently, the library is used for this
tutorial is 6.30.5

  • Create a config file.
  • After downloading the file add your Secret key and Publishable key in the config file.

Example:

require_once('vendor/autoload.php');
$stripe = [
"secret_key" => "********",
"publishable_key" => "*******",
];
\Stripe\Stripe::setApiKey($stripe['secret_key']);

Step 2:

Creating Accounts

With the necessary information in hand create a new customer account for the service provider.
Example:

require_once('./config.php');
require_once('./config.php');
$account = \Stripe\Account::create([
'country' => {Country}',
'type' => {Custom, Express}',
"email" => "[email protected]",
"requested_capabilities" => ["platform_payments"],
"business_profile" => [
'url' => {Business Url}",
],
"business_type" => "individual",
"individual" => [
"first_name" => {First Name Of The Account Holder}",
"last_name" => {Last Name Of The Account Holder},
"address" => [
"city" => "{Address Of The Account Holder}"
],
"dob" => [
"day" => {Dob Day Of The Account Holder},
"month" => {Dob Month Of The Account Holder},
"year" => {Dob Year Of The Account Holder},
],
"ssn_last_4" => {Socila Security Number Of The Account Holder},
],
'tos_acceptance' => [
'date' => time(),
'ip' => $_SERVER['REMOTE_ADDR'],
],
]);

Check the link below for the extra parameters that you want to add.
https://stripe.com/docs/api/accounts/create

Step 3:

Add external bank account for the new customer created account to enable is payouts. Flow of funds here is to update the service provider’s account by adding a bank account to which Stripe will
transfer payments.
Example:

$account = \Stripe\Account::retrieve({Created Customer Account Number});
$account->external_accounts->create(["external_account" => {Parameters}]);

Check this link for the parameters to be passed for creating the external bank account
https://stripe.com/docs/api/external_account_bank_accounts/create

Step 4:

Processing Payment:

To pay contractors directly, simply process the charge on your account, setting a destination parameter that identifies the Stripe account that should receive the funds from the payment (i.e., the contractor). This requires a payment token created using the platform’s publishable API key.

$charge = \Stripe\Charge::create([
'amount' => {Total Account You Want To Transfer},
'currency' => {Currency In Which The Amount Is Being Transferred},
'source' => {Token Of The Card},
'destination' => {Account Number On Which The Amount Is To Be Transfered},
'application_fee' => {Total Fee That Your Marketplace Will Deduct},
]);

For more details, you can visit this site.
https://stripe.com/docs/recipes/on-demand-app

The post Stripe Recipes Building On Demand Apps In Php appeared first on The Right Software.



This post first appeared on The Right Software, please read the originial post: here

Share the post

Stripe Recipes Building On Demand Apps In Php

×

Subscribe to The Right Software

Get updates delivered right to your inbox!

Thank you for your subscription

×