Discussions
URLs for Webhooks
Which URLs are considered to be publicly accessible?
Posted by . 12 months ago
Webhook Events: Reference number to update my database record
Hi!
I am using the Checkout API and able to receive the json payload in my webhook (`checkout_session.payment.paid`, `payment.paid`, `payment.failed`). Now that I have to update the status in my database, I checked the json payload and there is no reference number I can use to update the record in my database even though initially in creating a checkout session I clearly put one.
Is it safe to use the `payment_intent_id` as a reference number? Because I think this is the only unique id I can store when I create a checkout session and also use it later when receiving a json payload in my webhook.
Thank you in advance!
Posted by Benz Web Dev about 1 year ago
Archive a Link (PHP) is not working
Example Reference Number = FFFFFF
Example Auth = Basic 555555676664564543Fer453345'
Code:
<?php
require_once('vendor/autoload.php');
$client = new \\GuzzleHttp\\Client();
$response = $client->request('POST', '<https://api.paymongo.com/v1/links/FFFFFF/archive'>, \[
'headers' => [
'accept' => 'application/json',
'authorization' => 'Basic 555555676664564543Fer453345',
],
]);
echo $response->getBody();
Result:
{
"errors": [
{
"code": "resource_not_found",
"detail": "No such transaction with id FFFFFF."
}
]
}
Posted by KARL GLENN DEL ROSARIO about 1 year ago
Lessen Customers hassle by supporting query parameter string in Paymongo Link
We have an ecommerce that integrates paymongo Link.
Most of our customer are frustrated that they have to input their info again in paymongo link. Is there a way we could just pass a data on URL. Like sample below
<https://pm.link/PCWorth/NoXxXhL?first_name=john&last_name=doe>
Posted by John Joshua Dablo about 1 year ago
CRITICAL Uncaught Error: Call to undefined method GuzzleHttp\\Utils::chooseHandler() the path is does not exist
CRITICAL Uncaught Error: Call to undefined method GuzzleHttp\\Utils::chooseHandler() in /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins/wc-paymongo-payment-gateway/vendor/guzzlehttp/guzzle/src/functions.php:61
Posted by errol tudio about 1 year ago
Metadata check out session
Hello.
How to add metadata in check out session object?
In your Create a Checkout Session api, it seems no filed for metadata.
Just add directly to request body?
Posted by Tak Moonwalker about 1 year ago
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 about 1 year 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 about 1 year 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 about 1 year 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 about 1 year ago