#azadrajsingh_code

1 messages ยท Page 1 of 1 (latest)

sonic templeBOT
#

๐Ÿ‘‹ 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.

summer elbow
#

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()
         ];
     }
 }
bold rapids
#

Hi, let me help you with this.

summer elbow
#

req_nyBO9DW7SUVmCq

bold rapids
#

Looking...

#

I see this is a successful request.

summer elbow
#

I don have any request for above code

bold rapids
#

Where does the error come from?

summer elbow
bold rapids
#

Do you have a Checkout Session ID where this error happens?

glass sail
#

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.

glass sail
#

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.

summer elbow
#

But this error is coming when i am using inr currency

glass sail
#

where exactly do you see this error? in the API? the Checkout Session page? somewhere else?

twin flowerBOT
summer elbow
#

As validation below the form this error occurs

drifting plank
summer elbow
#

This type of error comming and i am using this function

drifting plank
summer elbow
#

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()
         ];
     }
 }
drifting plank
#

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.

sonic templeBOT
summer elbow
#

See here shipping address exist....

drifting plank
#

you also need the billing address.

spare sorrel
#

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