Why all the request values in this php method are null or undefined? (Laravel + Stripe)

Actually, the problem is simple (but not easy for me). I’ve made a backend project in laravel 11 to handle with my DB and comunicate with the Stripe api, that I have successfully achieved, the communication wit stripe works well, however, when i test it using Postman, the response that i recieve is the following:

{
    "error": "The amount must be greater than or equal to the minimum charge amount allowed for your account and the currency set (https://docs.stripe.com/currencies#minimum-and-maximum-charge-amounts).  If you want to save a Payment Method for future use without an immediate payment, use a Setup Intent instead: https://docs.stripe.com/payments/setup-intents"
}

And what i send from postman using the POST petition is:

{
    "amount": 2434,
    "currency": "usd"
}

As you can see, there are only tow values and when the response says “The amount must be greater than or equal to the minimum charge amount allowed for your account” refers to my “amount” key from my json object. ive checked the stripe docs and they say that the minimum quantity value of of the usd currency is $0.50 dollars, so i’m in the range. but also the usd comes to my api like undefined.

In the other hand if i do hardcoding of theese two values, the response i reseive is the following:

{
    "message": "Payment successful"
}

wich means that my code acctually work but just using hardcoding, wich i don’t wanna use.

As far as i know, i’m not making any mistake in my code, because i’m doint wath the doc say, that makes me think that the problem is something more strange like a configuration or an error into my framework’s file sistem, but that’s just my speculation.

This is the route I defined in mu api.php file to access the endpiont from postman:

Route::post('/create-checkout-session', [AppHttpControllerspaymentController::class, 'payment']);

and this is my controller that where stripe works:

<?php

namespace AppHttpControllers;

use Exception;
use illuminateHttpRequest;

class paymentController extends Controller
{
    public function payment(Request $request)
    {
        try {
            $stripe = new StripeStripeClient(env('STRIPE_SECRET'));

            $stripe->paymentIntents->create([
                'amount' => intval($request->input('amount')),
                'currency' => $request->input('currency'),
                'automatic_payment_methods' => ['enabled' => true],
            ]);
            return response()->json([
                'message' => 'Payment successful',
            ], 200);
        } catch (Exception $e) {
            return response()->json([
                'error' => $e->getMessage()
            ], 500);
        }
    }
}

iv’e tried using code a little bit different like this in the function, but the result was exactly the same:

            $stripe = new StripeStripeClient([
                'api_key' => env('STRIPE_SECRET')
            ]);
            $stripe->paymentIntents->create([
                'amount' => intval($request->input('amount')),
                // 'amount' => 1000,
                'currency' => $request->input('currency'),
                // 'currency' => "usd",
                'automatic_payment_methods' => ['enabled' => true],
            ]);

Acording to what i expect from the code, is to be able to catch the info that comes to my from the front (or postman) to send it to the stripe api avoiding using the “hardcoding” practice and continue developing my payment system, which i can’t becuase all i receive in the request is empty (null or undefined).

New contributor

TheBicMF is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật