Discussions
Paymongo 500 internal server error in Live Server
We are currently in the progress setting up the payment portion of our website, and it seemed straightforward enough to setup in the localhost to which it is working fine.
My understanding goes
Request from the front end...
```
const url = `${import.meta.env.VITE_API_BASE_URL}/pay?roomName=${roomName}&descriptionData=${descriptionData}&sendTotalAmount=${sendTotalAmount}&payId=${payId}`;
window.location.href = url;
```
```
```
Then the route....
Route::get('pay', [PaymentControllerCheckOut::class, 'pay']);
Then at the Controller
public function pay(Request $request)
Which works fine in localhost
but when deployed it returns with a 500 internal server error
Then we tried to make a function that is meant to test and see if Paymongo Check out can occur in the live server, but once again returned with the same error
public function test_pay(Request $request)
{
```
try {
$data = [
'data' => [
'attributes' => [
'line_items' => [
[
'currency' => 'PHP',
'amount' => 10000,
'name' =>'Custard',
'quantity' => 1,
]
],
'payment_method_types' => [
'card',
'gcash',
],
'success_url' => 'https://api.sirmatafarm.com/success',
'cancel_url' => 'https://api.sirmatafarm.com/cancelled',
'description' =>'Macha',
],
],
];
$response = Curl::to('https://api.paymongo.com/v1/checkout_sessions')
->withHeader('Content-Type: application/json')
->withHeader('accept: application/json')
->withHeader('Authorization: Basic ' .env('AUTH_PAY'))
->withData($data)
->asJson()
->post();
\Session::put('session_id', $response->data->id);
$sessionId = session('session_id');
return redirect()->to($response->data->attributes->checkout_url);
} catch (Exception $e) {
return response()->json(['error' => 'An error occurred while processing the payment.'], 500);
}
} public function test_pay(Request $request)
{
try {
$data = [
'data' => [
'attributes' => [
'line_items' => [
[
'currency' => 'PHP',
'amount' => 10000,
'name' =>'Custard',
'quantity' => 1,
]
],
'payment_method_types' => [
'card',
'gcash',
],
'success_url' => 'https://api.sirmatafarm.com/success',
'cancel_url' => 'https://api.sirmatafarm.com/cancelled',
'description' =>'Macha',
],
],
];
$response = Curl::to('https://api.paymongo.com/v1/checkout_sessions')
->withHeader('Content-Type: application/json')
->withHeader('accept: application/json')
->withHeader('Authorization: Basic ' .env('AUTH_PAY'))
->withData($data)
->asJson()
->post();
\Session::put('session_id', $response->data->id);
$sessionId = session('session_id');
return redirect()->to($response->data->attributes->checkout_url);
} catch (Exception $e) {
return response()->json(['error' => 'An error occurred while processing the payment.'], 500);
}
}
```
This is a our first time working with a payment gateway and wondering if there was a vital part we missed setting up?
Posted by Rubean Esguerra 3 months ago
Error: Do not use the secret key in the browser
I am trying to apply paymongo api on my ionic application.
I am using plugin of <https://paymongo.paolotiu.com/>.
Create Payment Method and Retrieve Payment Method was successful and running
Create Payment Intent was successful but retrieving always got an error.
Error using public key - Error: Request failed with status code 404
Error if I user secret key - Error: Do not use the secret key in the browser
I always got this error when I use secret key
Posted by JJ Alcuran 3 months ago
Inquiry Regarding Testing Environment for Paymongo Integration
I am currently in the process of developing an application that integrates with payment gateways, and I am interested in using Paymongo's services. Before proceeding with the integration, I wanted to confirm if there is a sandbox or testing environment available where I can simulate transactions and test the functionality of the integration without using actual funds.
Could you kindly provide information regarding the availability of such a testing environment? This would greatly assist me in ensuring the smooth and accurate integration of Paymongo's services into my application. Thank you!
Posted by Jayson Reales 3 months ago
Checkout Api
Hi! Good Day! Is there a way for us developers to remove or hide the redirect back to the merchant button after payment success?
Posted by Ej 4 months ago
How to simulate "payment.failed" in webhook api?
I've been configuring the webhook api, however I only managed to call source.chargeable and payment.paid. Is there a way to simulate payment.failed?
Posted by No Job No Honey Dev 4 months ago
How to get the customer input from custom field added to Paymongo Pages?
Hi,
Upon successful payment by the customer on Paymongo Pages, the associated endpoint (webhook) received a request body containing the payment details. However, it came to my attention that the customer input provided in the custom field, which I added to Paymongo Pages, was not included in the received request body. Nevertheless, I have observed that the said customer input is visible in Paymongo Payments Dashboard.
I would greatly appreciate your guidance on the possibility of obtaining the aforementioned customer data within the request body received from the webhook.
Thank you for your attention to this matter. I am looking forward to your assistance and support.
Posted by Tin Saulog 4 months ago
Can I create a checkout session with capture_type as manual?
I would like to take advantage of the pre-built checkout page to pre-authorize a payment prior to reserving an item in my inventory for the customer. If the item is available and the pre-auth is successful, I would capture the payment intent. If not, then I would expire the checkout session/cancel the payment intent.
As an example, Stripe supports this by allowing the developer to nest a `payment_intent_data` object within the `checkout_session` resource object when creating a checkout session.
Is this currently possible? or is there another recommended way of achieving this?
Thanks in advance :)
Posted by John Z 4 months ago
How to create a redirection to the website after successful payment has been done
1. After clicking 'Pay Now' button the customer will be redirected to paymongo
2. Once, all information asked is supplied. The payment will be processed as expected.
3. In my scenario, it will remain with the paymongo and ask that the window can be closed instead of redirecting it back to Customer Dashboard
Posted by Kurt 6 months ago
attributes cannot be blank
Why i have this error, i check attribute and it is not empty
\+"code": "invalid_payload_format"
+"detail": "attributes cannot be blank."
im using this code below
public function pay()
{
$data = \[
'data' => \[
'attributes' => \[
'amount' => 10000,
'payment_method_allowed' => [
'atome',
'card',
'dob',
'paymaya',
'billease',
'gcash',
'grab_pay'
],
'payment_method_options' => \[
'card' => [
'request_three_d_secure' => 'any'
]
],
'currency' => 'PHP',
'capture_type' => 'automatic'
]
]
];
```
// Send the API request to create a payment intent
$response = Curl::to('https://api.paymongo.com/v1/payment_intents')
->withHeader('accept: application/json')
->withHeader('authorization: Basic ' . env('AUTH_PAY'))
->withHeader('content-type: application/json')
->withData(json_encode($data))
->asJson()
->post();
dd($response);
// Check if the payment intent creation was successful
if ($response->data && $response->data->id) {
// Store the payment intent ID in the session
\Session::put('payment_intent_id', $response->data->id);
// Redirect the user to the checkout URL
return redirect()->to($response->data->attributes->checkout_url);
} else {
// Handle the case when the payment intent creation fails
// You can display an error message or redirect the user to an error page
}
}
```
Posted by Jaba 6 months ago
Transaction Limits
Is there a minimum/maximum amount per transaction for the different payment methods?
Posted by Timo Products 7 months ago