I am trying to pass the Stripe idempotency key to a Stripe payment intent in Laravel. The actual payments gets processed fine but I don't see the Idempotency key appear in the request (in the Stripe logs). Any guidance is really appreciated:
Code snippet below
$intent = $this->createPaymentIntent([
'amount' => $stripe_amount,
'currency' => config('services.stripe.currency'),
'payment_method' => $paymentMethod,
'transfer_data' => $transferDataArray,
"metadata" => $metaDataArray,
], [
'idempotency_key' => '**********'
]);
The idempotency key, if used, should appear in the upper section of your request log panel (green box):
The "original request" (blue box) points you to the initial request if the one you're looking at was a replay.
Related
Hope somebody can help me with this one.
I am clueless right now.
I just started stripe for the first time.
Looks like an amazing service.
Have created a test application and started testing.
Everything works as it should.
Now after signing up, I want to go live.
Here is where the problem occurs.
Somehow, it keeps saying no such token, when I can see the token standing in the stripe account. The id of the account and our database is completely the same.
Stripe::setApiKey('[our live token]');
/*
* create new customer
*/
$results = \Stripe\Charge::create([
"amount" => '10',
"currency" => "jpy",
"source" => $getCommission->unique_id,
"description" => "test charge"
]);
Anybody has ever experienced this?
It keeps saying the following
No such token: cus_EuguGZgeDoCxBj
Help is highly appriciated.
Wesley
You are providing customer id instead of source token.
Source Token :
Source token is token which is used for referenced of your cards. Generated from Stripe.js
\Stripe\Stripe::setApiKey("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
\Stripe\Charge::create([
"amount" => 2000,
"currency" => "usd",
"source" => "tok_amex", // obtained with Stripe.js
"description" => "Charge for jenny.rosen#example.com"
]);
How to get Default Source :
Get Stripe Customer
Get default source on the Behalf of that customer
\Stripe\Stripe::setApiKey("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
$customer = \Stripe\Customer::retrieve('cus_EkSwM3JX7f0ueA');
$customer->default_source; // use this as source token
Use default source as source token
I am facing following problem while doing stripe payment.
Uncaught exception 'Stripe\Error\Authentication' with message 'Only Stripe Connect platforms can work with other accounts. If you specified a client_id parameter, make sure it's correct
I am using the php code below:
$charge = \Stripe\Charge::create(
array(
"amount" => $amount*100, // amount in cents
"currency" => $currency, // usd
"source" => $token,
"description" => $description,
"application_fee" => 123 // amount in cents
),
array("stripe_account" => 'cus_7Gt1CAXXXXXX') // CONNECTED_STRIPE_ACCOUNT_ID
);
And another question is that from where I can get CONNECTED_STRIPE_ACCOUNT_ID like that acct_12QkqYGSOD4XXXXXX. if possible please send code or screenshot or location to get these account id.
Can anyone please help to solve that problem?
You have to create 'Connect with Stripe' button in your app which will redirect user to fill form to authorize your app.
After Clicking on Authorize button(by user,after filling form properly), it will redirect to 'Redirect URI(redirect URI is that URI which you fill in Platform Setting)'.
After redirection stripe will add scope and authorization code to your URI
for eg. your URI: www.yoursite.com
you will get www.yoursite.com?scope=read_write&authorization_code=AUTHORIZATION_CODE
After That follow----> https://stackoverflow.com/a/34714859/5467417
I'm currently setting a recurring paypal payment.
I'm not sure to understand when the first payment is done.
In my case, I want to first payment to be done when the user subscribe, and automaticaly renew after 3 month.
I'm not sure if the "INITAMT" parameter if the good way to do that.
Moreover, when I try to set the parameter "INITAMT" in sandbox, the résulting profile is always "PengindProfile"
Here is my parameters :
'METHOD' => 'CreateRecurringPaymentsProfile',
'TOKEN' => $token,
'PAYERID' => $payerId,
'USER' => $user,
'SIGNATURE' => $signature,
'PWD' =>$password,
'VERSION' => 74.0,
'PROFILESTARTDATE' => gmdate("Y-m-d\TH:i:s\Z"),
'DESC' => 'My subscription',
'BILLINGPERIOD' => 'Month',
'BILLINGFREQUENCY' => '3',
'AMT' => 10,
'CURRENCYCODE' => 'EUR',
'PAYERID' => XXX,
'MAXFAILEDPAYMENTS' => 3,
'INITAMT' => 10
And a finale question, how does the reccuring Payment works ? Paypal send the money on my account each 3 month ? It is possible to get a notification on a PHP serveur to update the subscription status ?
Thanks for your help !
I'd definitely look into using the PayPal PHP SDK instead of trying to use their REST API directly or via some minimal library. Their SDK provides much convenience working with the service and has plenty of use-case based examples including recurring billing and subscriptions.
I am trying to integrate Pin.net.au CC processing into my site. I am using Omnipay library to make the calls.
To not store CC details in my server, I am using the Pin.js token method.
On form submit page (after user fills in personal and CC details) javascript does a 'prevent default' and sends the data from forms (browser) straight to pin.net.au servers. Server sends a card_token in response and resubmits the form to my server.
This token is recieved successfully and I can output it in my tests.
I get into trouble when I take that token and send a purchase request to pin.net.au. According to the API docs, I need not send user and card details when I send the token (the entire point of the token, really). I send this token along with other compulsory bits like email, amount, description etc.
This works when I cURL on my terminal and I get a charge success.
However, sending this purchase/charge request using the Omnipay library, each time I get a 422 (invalid resource) that asks for the user details and CC information. It should have populated this stuff from the token I sent.
I have scoured the API docs of both Omnipay and Pin.net.au. I don't seem to be doing anything wrong. What am I missing?
Here's my charge request:
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey('MY_SECRET_KEY');
$response = $gateway->purchase([
'email' => 'user#email.com',
'description' => 'Package',
'amount' => '99',
'currency' => 'AUD',
'card_token' => Input::get('card_token'),
'ip_address' => Input::get('ip_address')
])->send();
Finally, it shouldn't really matter but if you'd like to know, I'm using Laravel 4.
Your example request has an amount of 99, the minimum amount for a Pin Payments charge is $1 (amount = 100).
I don't think this is the problem you are referring to though, it looks like Omnipay does not support using the card_token gear. If you go look over here - https://github.com/adrianmacneil/omnipay/blob/master/src/Omnipay/Pin/Message/PurchaseRequest.php#L34 - you can see Omnipay isn't sending the card_token field with it's request, it only tries to send card details, which obviously aren't present from your example!
Perhaps you could get in touch with the Omnipay developers or write a pull request yourself!
This is fixed in Omnipay v1.0.4 - you should be able to use the token like this:
$gateway = GatewayFactory::create('Pin');
$gateway->setSecretKey('MY_SECRET_KEY');
$response = $gateway->purchase([
'description' => 'Package',
'amount' => '99.00',
'currency' => 'AUD',
'token' => Input::get('token'),
'ip_address' => Input::get('ip_address'),
'card' => ['email' => 'user#email.com'],
])->send();
Using Venmo Touch, I'd client side validation and post the encrypted credit card details to our application server.
Application server retrieves the params inside the post method, and posts the retrieved params to Braintree server.
<?php $result = Braintree_Transaction::sale(array(
'amount' => '10.00',
'credit_card' => array(
'number' => $_POST['encrypted_card_number'],
'expirationMonth' => $_POST['encrypted_expiration_month'],
'expirationYear' => $_POST['encrypted_expiration_year']
),
'options' => array(
'venmo_sdk_session' => $_POST['venmo_sdk_session']
)));?>
If we ignore the 'options' tag, payment is successful. Upon introducing the 'options' array with element venmo_sdk_session Braintree server doesn't responds.
I'd doubt the key spelling/case sensitive "venmo_sdk_session".
Problem is not within the code.
We need to enable Venmo Touch, Payment Method Verification on settings screen of Braintree site using our account.