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);
Related
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.
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 !
Well, I want to send an automated email every Friday using MailChimp/Mandrill.
Email Template :
Hi {{firstName}},
You weekly weekend pass is {{code}}.
Here, My email content is dynamically generated. So, before sending automated email, there should be some mechanism where I call the rest api from where I get the firstName and code. Then email is sent to different user.
{
[{
firstName: 'test',
code: 'Xewetwerx'
},
{
firstName: 'test2',
code: 'Xewetwrtd'
}]
}
I know we can write code in our backend server and call the API every Friday using cronjob(to send an email every Friday) but I don't want to use any cronjob.
Is it possible to make API call and send automated mail using MailChimp or mandrill ???
Outcome:
2 email should be sent with different code.
Mandrill implements scheduled emails through the sent_at parameter.
It's possible to send an email using a template and specify date and time when the message should be sent as a UTC timestamp in YYYY-MM-DD HH:MM:SS format. If you specify a time in the past, the message will be sent immediately. Note that for the sent_at feature you will need a paid (non free) account
If you choose PHP as the programming language for your backend,
you can use the official PHP API library.
example: (the code is not tested and could contain errors)
require_once '/path/to/MailchimpTransactional/vendor/autoload.php';
$mailchimp = new MailchimpTransactional\ApiClient();
$mailchimp->setApiKey('YOUR_API_KEY');
$msg = array(
'subject' => 'My subject',
'from_email' => 'ellery#example.com',
'to' => array(array('email' => 'recipient1#example.com', 'name' => 'Recipient 1'),array('email' => 'recipient2#example.com', 'name' => 'Recipient 2')),
'merge_vars' => array(array(
'rcpt' => 'recipient1#example.com',
'vars' =>
array(
array(
'name' => 'firstName',
'content' => 'test'),
array(
'name' => 'code',
'content' => 'Xewetwerx')
)),
array(
'rcpt' => 'recipient2#example.com',
'vars' =>
array(
array(
'name' => 'firstName',
'content' => 'test2'),
array(
'name' => 'code',
'content' => 'Xewetwrtd')
))));
$response = $mailchimp->messages->sendTemplate([
"template_name" => "template_name",
"template_content" => [[]],
"message" => $msg,
"send_at" => "2021-06-23 09:05:00" ,
]);
print_r($response);
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";
}
I'm using CodeIgniter Payments to integrate with the Paypal API. I believe I am calling the right methods because I'm getting a response of "Success" but I don't see the transaction in the Sandbox. When I use the sample DoDirectPayment file from Paypal I complete the transaction and I can see it in the sandbox.
Here is my code using CodeIgniter Payments:
//load the payment library
$this->load->spark('codeigniter-payments/0.1.4/');
//configure the parameters for the payment request
$paymentParameters = array(
'cc_type' => 'foo',
'cc_number' => 'foo',
'cc_exp' => 'foo',
'first_name' => 'foo',
'last_name' => 'foo',
'street' => 'foo',
'street2' => 'foo',
'city' => 'foo',
'state' => 'foo',
'country' => 'foo',
'postal_code' => 'foo',
'amt' => 'foo',
'currency_code' => 'USD'
);
//make the call
$paymentResponse = $this->payments->oneoff_payment('paypal_paymentspro', $paymentParameters);
//print the response
print_r($paymentResponse);
Here is the response:
stdClass Object
(
[type] => gateway_response
[status] => Success
[response_code] => 100
[response_message] => The authorization was successful.
[details] => stdClass Object
(
[gateway_response] => stdClass Object
(
[TIMESTAMP] => 2012-05-22T19:18:17Z
[CORRELATIONID] => 7939eeaa6c0c0
[ACK] => Success
[VERSION] => 66.0
[BUILD] => 2929894
[AMT] => 20.89
[CURRENCYCODE] => USD
[AVSCODE] => X
[CVV2MATCH] => M
[TRANSACTIONID] => 4RS01101TL8204042
)
[timestamp] => 2012-05-22T19:18:17Z
[identifier] => 4RS01101TL8204042
)
)
You can just switch into using other Paypal libraries. It might save you time than figuring out this problem. http://codeigniter.com/wiki/PayPal_Lib
I had this problem too.
In my case, I did not set my config driver correctly and it ended up sending all my transactions to Calvin's (Author's) default paypal sandbox account.
Double check to make sure that your API tokens are set correctly with:
$gateway_name = 'paypal_paymentspro';
$params = array(
'identifier' => *Your transaction ID from above*
);
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);
Also, if you don't want to set the driver and want to do everything from your PHP file, you can always pass in your API tokens like so:
$gateway_name = 'paypal_paymentspro';
$params = array(
'identifier' => *Your transaction ID from above*
);
$config['api_username'] = *Your api username*;
$config['api_password'] = *Your api password*;
$config['api_signature'] = *Your sig*;
$response = $this->payments->get_transaction_details($gateway_name, $params);
print_r($results);