Enngage / ngx-paypal

Paypal integration for Angular
https://enngage.github.io/ngx-paypal/
MIT License
185 stars 68 forks source link

amount is not changing from 0.01 #188

Open JunaidVenrup opened 3 years ago

JunaidVenrup commented 3 years ago

this.payPalConfig = { currency: this.currency, clientId: environment.paypal, createOrder: (data) =>

{ intent: 'CAPTURE', purchase_units: [ { amount: { currency_code: this.currency, value: this.price, breakdown: { item_total: { currency_code: this.currency, value: this.price, }, }, }, items: [ { name: this.vendor, quantity: this.quantity, category: this.productName, unit_amount: { currency_code: this.currency, value: this.price, }, }, ], }, ], }, advanced: { commit: 'true', }, style: { label: 'paypal', layout: 'horizontal', color: 'black', tagline: '', }, onApprove: (data, actions) => { console.log( 'onApprove - transaction was approved, but not authorized', data, actions ); actions.order.get().then((details) => { console.log( 'onApprove - you can get full order details inside onApprove: ', details ); }); }, onClientAuthorization: (data) => { console.log( 'onClientAuthorization - you should probably inform your server about completed transaction at this point', data ); this.paymentDone.emit(true); }, onCancel: (data, actions) => { console.log('OnCancel', data, actions); }, onError: (err) => { console.log('OnError', err); this.toast.error('Please try again later!', 'Something Went Wrong'); }, onClick: (data, actions) => { console.log('onClick', data, actions); }, }; } amount always stays same to 0.01 on checkout no matter whatever I do, I've tried putting static values but all in vain, I am using latest version 8.0.0
rubengg86 commented 2 years ago

I was struggling with this a lot, instead use createOrder use createOrderOnClient. Cheers

saranglakare commented 6 months ago

See this solution : https://github.com/Enngage/ngx-paypal/issues/242#issuecomment-1980607827

If works if you are ok creating subscriptions on client.