Stripe, Send money to Customer - laravel

I am making an app like Uber. I want to pay employees every start of week. but i don't have any idea about it. Every week the system will calculate and pay the driver's salary.
With the Bank information submitted by the customer, I transferred money from the customer to the admin, but I don't know how to pay the driver's salary.o the customer.
This my code
// account test
$bank = $stripe->tokens->create([
'bank_account' => [
'country' => 'US',
'currency' => 'usd',
'account_holder_name' => 'Jenny Rosen',
'account_holder_type' => 'individual',
'routing_number' => '110000000',
'account_number' => '000123456789',
],
]);
// create account
$account = \Stripe\Account::create(
array(
"country" => "US",
'type' => 'custom',
'capabilities' => [
'card_payments' => [
'requested' => true,
],
'transfers' => [
'requested' => true,
],
],
'external_account' => $bank->id
)
);
$re = $stripe->transfers->create([
'amount' => 400,
'currency' => 'usd',
'destination' => $account->id,
'transfer_group' => 'ORDER_95',
]);
return $re;
Error response:
"Your destination account needs to have at least one of the following capabilities enabled: transfers, legacy_payments".
How to pay employee via Stripe. Please help me !

Related

Cannot create payouts: this account has requirements that need to be collected. in Laravel connecting to Stripe

when want to connect to Stripe api to payout blance of my wallet to one customer account card, i faced this prblem.
acctually my laravel codes is:
**$card_obj = $stripe->tokens->create([
'card' => [
'number' => '4000051240000005',
'exp_month' => 8,
'exp_year' => 2023,
'cvc' => '314',
'currency' => 'cad',
],
]);
$account = $stripe->accounts->create([
'type' => 'express',
'country' => 'CA',
'capabilities' => [
'card_payments' => ['requested' => true],
'transfers' => ['requested' => true],
],
'external_account' => $card_obj->id,
]);
$payout = $stripe->payouts->create([
'amount' => 1,
'currency' => 'cad',
], [
'stripe_account' => $account->id,
]);**
and the error that response returned:
enter image description here
You cannot create a Stripe connect account and immediately start creating payouts for it. If you were to retrieve that Account through the API you'd probably see that it has a number of requirements (see api ref) that are still unfulfilled and payouts_enabled (see api ref) is false.
Connect account owners are expected to provide this missing information during the onboarding process (see https://stripe.com/docs/connect/express-accounts for how to implement an onboarding flow), and once payouts_enabled becomes true on the Account you should be able to generate payouts.

Stripe webhook test returns empty table on execution, but works on stripe's webhook tester

We're having a problem with our test suite.
When we run this using the test suite we get a 'The table is empty...' response from PHPUnit.
We know it works as we've also tested using Stripe's 'Send a web hook' test function which works, and the response is stored as expected.
Our code is here:
public function test_webhook_received()
{
$this->expectsJobs([StoreStripeWebHookJob::class]);
$this->postJson('/stripeHook', [
'created' => 1326853478,
'livemode' => false,
'id' => 'evt_00000000000000',
'type' => 'account.external_account.created',
'object' => 'event',
'request' => NULL,
'pending_webhooks' => 1,
'api_version' => '2019-12-03',
'data' => [
'object' => [
'id' => 'ba_00000000000000',
'object' => 'bank_account',
'account' => 'acct_00000000000000',
'account_holder_name' => 'Jane Austin',
'account_holder_type' => 'individual',
'bank_name' => 'STRIPE TEST BANK',
'country' => 'US',
'currency' => 'gbp',
'fingerprint' => '8JXtPxqbdX5GnmYz',
'last4' => '6789',
'metadata' => [],
'routing_number' => '110000000',
'status' => 'new',
],
],
]);
$this->assertDatabaseHas('stripe_webhooks', [
'stripe_created_at' => 1326853478,
'type' => 'account.external_account.created',
]);
}
The response received is:
Failed asserting that a row in the table [stripe_webhooks] matches the
attributes {
"stripe_created_at": 1326853478,
"type": "account.external_account.created" }.
The table is empty..
If we remove the
$this->expectsJobs([StoreStripeWebHookJob::class]);
tests succeed. Obviously the expectsJob() call should be where it is though.
ExpectsJob also intercepts the job. Much like expectsException. Judging from your clean naming convention "StoreStripe..." - I'd say it's really not storing under these test circumstances.
You'll need to test separately that your endpoint/controller is queuing a job... and that the job is storing the data. 2 tests.

Can I just add Card Details without charging the customer with Stripe?

I need my customers to add their credit card info, but I don't want to charge them right away. Is there any way, I can add their details to charge later when using Stripes checkout solution and just store their card token first?
I am using Laravel Cashier on the backend.
with Laravel cashier it is realy hard to do that. You have to tweak it a little bit..
But with Stripe you can create customers and charge them later with info.
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
// Create a Customer:
$customer = \Stripe\Customer::create([
'source' => 'tok_mastercard',
'email' => 'paying.user#example.com',
]);
// Charge the Customer instead of the card:
$charge = \Stripe\Charge::create([
'amount' => 1000,
'currency' => 'usd',
'customer' => $customer->id,
]);
// YOUR CODE: Save the customer ID and other info in a database for later.
// When it's time to charge the customer again, retrieve the customer ID.
$charge = \Stripe\Charge::create([
'amount' => 1500, // $15.00 this time
'currency' => 'usd',
'customer' => $customer_id, // Previously stored, then retrieved
]);
Hope this helps.
// Set Stripe API key
\Stripe\Stripe::setApiKey("sk_test_HGJJKJLJLKHKJHGJHGKH");
// Retrieve Customer
$customer = \Stripe\Customer::retrieve("cus_KJHKJHJKJKHKJHKJ");
// Create new card
$data = [
"type" => "card",
"card" => [
"exp_month" => "01",
"exp_year" => "20",
"number" => "4242424242424242",
"cvc" => "123",
],
];
$card = \Stripe\Source::create($data);
// Assign the created card to the customer
$customer->sources->create(["source" => $card['id']]);
Enter card details
$token=Token::create(['card'=>
[
'number'=>'4242 4242 4242 4242',
'exp_month'=>12,
'exp_year'=>2022,
'cvc'=>121
],
)];
**//Set Stripe API key**
$stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
$stripe=$stripe->customers->createSource(
$customer->id,
['source' => $token->id
]);
reference
https://stripe.com/docs/api/tokens/create_card

paymenwall gateway integration with laravel 5.1

I tried to implement paymentwall gateway with laravel 5.1 using omnipay.But there is no exact documentation or sample codes available.Is there any implementation samples available for omnipay paymentwall integration with laravel.
There is documentation including usage examples in the class header files for the omnipay-paymentwall library.
Example
// Create a gateway for the PaymentWall REST Gateway
// (routes to GatewayFactory::create)
$gateway = Omnipay::create('PaymentWall');
// Initialise the gateway
$gateway->initialize(array(
'apiType' => $gateway::API_GOODS,
'publicKey' => 'YOUR_PUBLIC_KEY',
'privateKey' => 'YOUR_PRIVATE_KEY',
));
// Create a credit card object
// This card can be used for testing.
$card = new CreditCard(array(
'firstName' => 'Example',
'lastName' => 'Customer',
'number' => '4242424242424242',
'expiryMonth' => '01',
'expiryYear' => '2020',
'cvv' => '123',
'email' => 'customer#example.com',
'billingPostcode' => '4999',
));
// Do a purchase transaction on the gateway
$transaction = $gateway->purchase(array(
'amount' => '10.00',
'accountId' => 12341234,
'currency' => 'AUD',
'clientIp' => '127.0.0.1',
'packageId' => 1234,
'description' => 'Super Deluxe Excellent Discount Package',
'fingerprint' => '*token provided by Brick.js*',
'browserDomain' => 'SiteName.com',
'card' => $card,
));
$response = $transaction->send();
if ($response->isSuccessful()) {
echo "Purchase transaction was successful!\n";
$sale_id = $response->getTransactionReference();
echo "Transaction reference = " . $sale_id . "\n";
}

Recurring payment in paypal integration with codeigniter is not working

Hello I am new to PayPal integration. I am using the Express checkout of PayPal for payment.
I wrote the code use SetExpressCheckout method then GetExpressCheckout method and then use DoExpressCheckout method. After DoExpressCheckout I am calling the CreateRecurringPaymentsProfile for recurring payment. Code as follows-
$recurringdata = array(
'TOKEN' => $token,//token id
'PayerID' => $payerid,//payer id
'PROFILESTARTDATE' => date('Y-m-d H:i:s',$time),
'DESC' => "description",
'BILLINGPERIOD' => 'Day',
'BILLINGFREQUENCY' => 1,
'AMT' =>$checkoutDetails['PAYMENTREQUEST_0_AMT'],
'TRIALBILLINGPERIOD'=>'Day',
'TRIALBILLINGFREQUENCY'=>1,
'TRIALAMT'=> 0,
'CURRENCYCODE' => 'USD',
'COUNTRYCODE' => 'US',
'MAXFAILEDPAYMENTS' =>3
);
$responserecurring = $paypal->request('CreateRecurringPaymentsProfile', $recurringdata);
This code creates the profile but I can not see that any recurring payment is done. I am not getting what actually happens. Is am I missing to pass any parameter in request.
Actually i am missing the one parameter i.e. 'TRIALTOTALBILLINGCYCLES'. This parameter is an optional so i am not used this. So my trail period goes in infinite state. So payment is not deducting from account.I pass the data like as_
$recurringdata = array(
'TOKEN' => $token,//token id
'PayerID' => $payerid,//payer id
'PROFILESTARTDATE' => date('Y-m-d H:i:s',$time),
'DESC' => "description",
'BILLINGPERIOD' => 'Day',
'BILLINGFREQUENCY' => 1,
'AMT' =>$checkoutDetails['PAYMENTREQUEST_0_AMT'],
'TRIALBILLINGPERIOD'=>'Day',
'TRIALBILLINGFREQUENCY'=>1,
'TRIALAMT'=> 0,
'TRIALTOTALBILLINGCYCLES' => 1,
'CURRENCYCODE' => 'USD',
'COUNTRYCODE' => 'US',
'MAXFAILEDPAYMENTS' =>3
);
$responserecurring = $paypal->request('CreateRecurringPaymentsProfile', $recurringdata);

Resources