paypal angular sandbox, receiving not approved order ,when Capture even OnApprove is triggered
porsha_app
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Sep-12-2024
03:41 PM
Trying to test sandbox business accound Albania.
Receiving "Payer has not yet approved the Order for payment" Order is created correctly.
angular code
try {
this.paypal = await loadScript({ clientId : clientId });
} catch (error) {
console.error("failed to load the PayPal JS SDK script", error,HttpStatusCode);
}
if (this.paypal) {
try {
await this.paypal.Buttons({
style: {
layout: 'vertical',
color: 'gold',
},
createOrder : this.createOrderPaypal(),
onApprove : (data: any, actions: any) => {
//actions.order.capture().then(this.approveOrderPaypal())
this.approveOrderPaypal()
},
}).render("#buttonPaypal");
} catch (error) {
console.error("failed to render the PayPal Buttons", error);
}
}
dotnet code:
private async Task<dynamic> _CreateOrder(PayPalOrder newOrder,string _paypalClientId, string _paypalClientSecret, string _base)
{
var accessToken = await GenerateAccessToken(_paypalClientId,_paypalClientSecret,_base);
var url = $"{_base}/v2/checkout/orders";
var payload = new
{
intent = "CAPTURE",
purchase_units = new[]
{
new
{
description = newOrder.Description,
amount = new
{
currency_code = newOrder.CurrencyCode,
value = newOrder.Value
}
}
}
};
.....
var response = await client.SendAsync(request);
return await HandleResponse(response);
}
private async Task<dynamic> _CaptureOrder(string orderID, string _paypalClientId, string _paypalClientSecret, string _base)
{
var accessToken = await GenerateAccessToken(_paypalClientId,_paypalClientSecret,_base);
var url = $"{_base}/v2/checkout/orders/{orderID}/capture";
.....
var response = await client.SendAsync(request);
return await HandleResponse(response);
}
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Issues with PayPal Express Checkout Integration in Sandbox Environment
- Advanced Checkout Error Trigger is not triggering an error but still going through onApprove in Sandbox Environment
- Paypal subscription button - Popup not closing and onApprove not triggered in SDKs
- JavaScript SDK unreliable redirect using "Sofortüberweisung" Klarna payment provider in SDKs