#azadrajsingh_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1242768700667334666
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
This is my function which is i am using
public static function stripeCheckout($price, $name, $email, $currency)
{
$auth_user = Auth::guard('recruiter')->user();
$stripe = new \Stripe\StripeClient(ENV('STRIPE_SECRET'));
try {
$redirectUrl = route('recruit.stripe.checkout.success') . '?session_id={CHECKOUT_SESSION_ID}';
$customer = $stripe->customers->create([
'email' => $email,
'name' => isset($auth_user->employer->company_name) ? $auth_user->employer->country_id : '',
'address' => [
'line1' => isset($auth_user->employer->address1) ? $auth_user->employer->address1 : '',
'line2' => isset($auth_user->employer->address2) ? $auth_user->employer->address2 : '',
'city' => isset($auth_user->employer->city) ? $auth_user->employer->city : '',
'state' => isset($auth_user->employer->state->name) ? $auth_user->employer->state->name : '',
'postal_code' => isset($auth_user->employer->postcode) ? $auth_user->employer->postcode : '',
'country' => isset($auth_user->employer->country_id) ? HelperService::getcountryNameBycountryId($auth_user->employer->country_id) : '',
],
]);
$response =
$stripe->checkout->sessions->create([
'success_url' => $redirectUrl,
'customer' => $customer->id,
'payment_method_types' => ['card'],
'line_items' => [
[
'price_data' => [
'product_data' => [
'name' =
],
'unit_amount' => 100 * $price,
'currency' => $currency,
],
'quantity' => 1
],
],
'mode' => 'payment',
'invoice_creation' => ['enabled' => true],
'allow_promotion_codes' => true,
'shipping_address_collection' => [
'allowed_countries' => ['IN', 'GB', 'AU', 'NZ']
],
]);
return redirect($response['url']);
} catch (\Stripe\Exception\InvalidRequestException $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
} catch (\Stripe\Exception\AuthenticationException $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
} catch (Exception $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
}
}
Hi, let me help you with this.
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_nyBO9DW7SUVmCq
I don have any request for above code
Where does the error come from?
When i submit stripe form if i select india this error show
Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports
Do you have a Checkout Session ID where this error happens?
hi! I'm taking over this thread. If you have a Request ID or Checkout Session ID with that error, it would help.
but to me the error message yous shared is pretty clear: Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports. If you are trying to use a non-INR currency, then the shipping/billing address needs to be outside of India.
I this this is what you need
cs_test_b1pVzS0orOvv9Vhn2x1PjV9RMGkFu2LQ9YpdCVMOMCV1fTLlfgSHFK15v3
did you read my explanation above?
to me the error message yous shared is pretty clear: Non-INR transactions in India should have shipping/billing address outside India. More info here: https://stripe.com/docs/india-exports. If you are trying to use a non-INR currency, then the shipping/billing address needs to be outside of India.
But this error is coming when i am using inr currency
where exactly do you see this error? in the API? the Checkout Session page? somewhere else?
As validation below the form this error occurs
yep. So you have to collect shipping and billing address in Checkout. https://docs.stripe.com/payments/collect-addresses?payment-ui=checkout#collect-an-address is how to do that.
yep. So you have to collect shipping and billing address in Checkout. https://docs.stripe.com/payments/collect-addresses?payment-ui=checkout#collect-an-address is how to do that.
public static function stripeCheckout($price, $name, $email, $currency)
{
$auth_user = Auth::guard('recruiter')->user();
$stripe = new \Stripe\StripeClient(ENV('STRIPE_SECRET'));
try {
$redirectUrl = route('recruit.stripe.checkout.success') . '?session_id={CHECKOUT_SESSION_ID}';
$customer = $stripe->customers->create([
'email' => $email,
'name' => isset($auth_user->employer->company_name) ? $auth_user->employer->country_id : '',
'address' => [
'line1' => isset($auth_user->employer->address1) ? $auth_user->employer->address1 : '',
'line2' => isset($auth_user->employer->address2) ? $auth_user->employer->address2 : '',
'city' => isset($auth_user->employer->city) ? $auth_user->employer->city : '',
'state' => isset($auth_user->employer->state->name) ? $auth_user->employer->state->name : '',
'postal_code' => isset($auth_user->employer->postcode) ? $auth_user->employer->postcode : '',
'country' => isset($auth_user->employer->country_id) ? HelperService::getcountryNameBycountryId($auth_user->employer->country_id) : '',
],
]);
$response = $stripe->checkout->sessions->create([
'success_url' => $redirectUrl,
'customer' => $customer->id,
'payment_method_types' => ['card'],
'line_items' => [
[
'price_data' => [
'product_data' => [
'name' =
],
'unit_amount' => 100 * $price,
'currency' => $currency,
],
'quantity' => 1
],
],
'mode' => 'payment',
'invoice_creation' => ['enabled' => true],
'allow_promotion_codes' => true,
'shipping_address_collection' => [
'allowed_countries' => ['IN', 'GB', 'AU', 'NZ']
],
]);
return redirect($response['url']);
} catch (\Stripe\Exception\InvalidRequestException $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
} catch (\Stripe\Exception\AuthenticationException $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
} catch (Exception $e) {
return [
'status' => false,
'error' => $e->getMessage()
];
}
}
well in the screenshot you posted earlier, there was no shipping address collection input, so that screenshot can not have come from that ^^ code, maybe you didn't save/deploy the changes.
you also need the billing address.
The error is pretty explicit: it's a non-INR payment so it cannot be complete with IN based addresses as the 4242 card is US based