I'm trying to integrate PayPal checkout in my angular website. the integration seems to be fine but I always have an error when creating an order. Below you will find all the code I used.
index.html
<head> ...<script src="https://www.paypal.com/sdk/js?client-id=MY-APP-SANDBOX-ID"></script></head>
donation.component.ts
declare var paypal;...export class DonationComponent implements OnInit{ ... ngOnInit(): void { ... paypal.Buttons({ createOrder: (data, actions) => { return actions.order.create({ purchase_units: [{ description: "Donation For Al-Darb Platform.", amount: { currency_code: 'USD', value: this.value } }] }); }, onApprove: async (data, actions) => { const order = await actions.order.capture(); console.log(order); }, onError: err => { console.log(err); } }).render(this.paypalElement.nativeElement); }}
donation.component.html
...<div #paypal></div>
After executing everything works fine only on checkout (after log in to Paypal and validating the payment). I always got the following error HTTP 400:
{ ack: "contingency", contingency: "UNPROCESSABLE_ENTITY" data: {name: "UNPROCESSABLE_ENTITY", details: [{ issue: "COMPLIANCE_VIOLATION" ...}], ...}