Discussions
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 9 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 11 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 11 months ago
Transaction Limits
Is there a minimum/maximum amount per transaction for the different payment methods?
Posted by Timo Products 12 months ago
Error in Making Payment Method Resource on Javascript Client Side
Hello. I am trying to create a Payment Method Resource on Javascript Client Side.But I got this error.
{"readyState":4,"responseText":"{\"errors\":[{\"code\":\"parameter_data_type_invalid\",\"detail\":\"details.exp_month should be an integer.\",\"source\":{\"pointer\":\"details.exp_month\",\"attribute\":\"exp_month\"}},{\"code\":\"parameter_data_type_invalid\",\"detail\":\"details.exp_year should be an integer.\",\"source\":{\"pointer\":\"details.exp_year\",\"attribute\":\"exp_year\"}}]}","responseJSON":{"errors":[{"code":"parameter_data_type_invalid","detail":"details.exp_month should be an integer.","source":{"pointer":"details.exp_month","attribute":"exp_month"}},{"code":"parameter_data_type_invalid","detail":"details.exp_year should be an integer.","source":{"pointer":"details.exp_year","attribute":"exp_year"}}]},"status":400,"statusText":"error"}
var authorizationHeader = 'Basic ' + btoa('pk_test_mycode');
$.ajax({
method:'POST', url:'<https://api.paymongo.com/v1/payment_methods'>, headers:{Authorization:authorizationHeader, contentType:'application/json', dataType:'json'},
data:{
data:{
attributes:{
type:'card',
details:{
card_number:'4343434343434345', exp_month:5, exp_year:2026, cvc:'111'
}
}
}
},
success: function(data, status, xhr){
alert('success ' + data);
},
error: function (xhr, status, error){
var errmsg = JSON.stringify(xhr) + '<br><br>' + status + '<br><br>' + error;
alert(errmsg);
}
});
Please tell me what is wrong. Please respond immediately. Thank you.
Posted by null 12 months ago
CreateACheckout is not a valid operation.
This is my strapi backend:
```
use strict";
const sdk = require("api")("@paymongo/v2#5u9922cl2759teo");
/**
* order controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController("api::order.order", ({ strapi }) => ({
async create(ctx) {
const { products } = ctx.request.body;
const lineItems = products.map((product) => ({
amount: Math.round(product.price * 100),
currency: "PHP",
description: product.desc,
// images: [product.image],
name: product.name,
quantity: product.quantity,
}));
const data = {
attributes: {
cancel_url: "http://example.com/cancel",
billing: {
address: {
line1: "123 Main St.",
line2: "Suite 1",
city: "Makati",
state: "Metro Manila",
postal_code: "1234",
country: "PH",
},
name: "John Doe",
email: "[email protected]",
phone: "+639123456789",
},
description: "My order",
line_items: lineItems,
payment_method_types: ["card"],
reference_number: "123456",
send_email_receipt: false,
show_description: true,
show_line_items: true,
success_url: "http://example.com/success",
statement_descriptor: "My Business",
},
};
try {
sdk.auth("sk_test_SsQLejeRVDfVskZevWq4Dtku");
const response = await sdk.createACheckout({ data: data });
const checkout = response.data;
await strapi.services.order.create({
paymongo_checkout_id: checkout.data.id,
products,
});
ctx.send({ checkout });
} catch (error) {
console.error(error);
ctx.badRequest(error);
}
},
}));
```
And this is the error I received:
```
Error: Sorry, `createACheckout` does not appear to be a valid operation on this API.
at Proxy.<anonymous> (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:173:47)
at step (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:33:23)
at Object.next (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:14:53)
at D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:8:71
at new Promise (<anonymous>)
at __awaiter (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:4:12)
at Proxy.accessorHandler (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\api\dist\index.js:165:28)
at Object.create (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\src\api\order\controllers\order.js:53:36)
at dispatch (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\koa-compose\index.js:42:32)
at returnBodyMiddleware (D:\Users\rules\Desktop\JS\Anciado Furniture\Api\anciado-furniture-api\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:52:24)
```
And I was curious on what operations are available so I did this:
```
console.log("Available operations in PayMongo SDK:");
Object.getOwnPropertyNames(sdk).forEach((operation) => {
console.log("- " + operation);
});
```
And it console logged this:
```
Available operations in PayMongo SDK:
- auth
- config
- server
```
There's no CreateACheckout, retrieveListOfPossibleMerchantPaymentMethods
Posted by null 12 months ago
Recurring payments update
Do you have updates with recurring payments? I mean, do you now support it?
Posted by Aedan Villareal about 1 year ago
Paymongo payload to Webhook
Paymong doesnt sending payload to my Webhook
Posted by Karl Ayco about 1 year ago
ROBUST API
HELLO I INTEGRATE CHECKOUT BUT IT SEEMS WHEN I CLICK CHECKOUT AND CHOOSE GCASH EWALLET PAYMENT IT DIRECT TO PAYMONGO CHECKOUT PAGE. NOT IN THE OTHER PAGE WHEN I CAN LOGIN MY GCASH AND PIN TO PAY.
Posted by ano about 1 year ago
Why is my Webhook to Endpoint not Receiving an Event?
Webhook already created and its not Receiving Event direct on my api endpoint.
My url is accessible and when I test using Postman, it works.
\--url from webhook
<https://myWebsite/WebApiEndpoint>
Posted by null about 1 year ago