Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
273 stars 81 forks source link

[QUESTION] #49

Open VapiSoft opened 4 years ago

VapiSoft commented 4 years ago

I click on the cutton, and pay from Sand-Box buyer account. The paypal accepts the payment, and deduct it from the buyer account. But

  1. It doesn't add it to the seller account.
  2. it does not get back to the component (onResult or onError), so I assume it crashed somewhere. But when it closes PayPal window, it does remove the "opaque" efect from my client.

class MyPayPal extends React.Component { render() { return ( <PayPalButton options={{ clientId:"XXX", currency:"ILS" }} loacle= "he_IL" amount="10.0" shippingPreference="NO_SHIPPING" // default is "GET_FROM_FILE" onSuccess={(details, data) => { log('onSuccess: details=',details); log('onSuccess: data=',data); }} onError={(details, data) => { log('onError: details=',details); log('onError: data=',data); }} onApprove={(details, data) => { log('onApprove: details=',details); log('onApprove: data=',data); }} onCancel={(details, data) => { log('onApprove: details=',details); log('onApprove: data=',data); }} /> ); } }

talesdsp commented 4 years ago

you need to add to the props options:{{ clientId: <YOUR_CLIENT_ID> }}
This comes from the api you created, not the fake email

Anotação 2020-01-27 125229

VapiSoft commented 4 years ago

Thanks for the reply. I know what is my Client ID. Idon't understand where I put this options:{{ clientId: }} I tried this: <PayPalButton amount="1.0" options={{ clientId: "XXXXXXXXXXXXXXXXXXXXXXXX"}} onSuccess={(details, data) => { log('onSuccess: details=',details); log('onSuccess: data=',data); }} onError={(err) => { log('onError: err=',err); }} /> But it still didn't work.

Shlomo Aran 054-7399-340

On Mon, Jan 27, 2020 at 6:00 PM Tales Pereira notifications@github.com wrote:

you need to add to the props options:{{ clientId: }} This comes from the api you created, not the fake email

[image: Anotação 2020-01-27 125229] https://user-images.githubusercontent.com/42183799/73189983-0eab3f80-4104-11ea-9a0b-d5fe20906b81.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Luehang/react-paypal-button-v2/issues/49?email_source=notifications&email_token=ABLKC3JCABES4XIWJQ7BS2DQ74ALLA5CNFSM4KCUIN4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAA2LA#issuecomment-578817324, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLKC3JLINP2QHNASXGBOM3Q74ALLANCNFSM4KCUIN4A .

talesdsp commented 4 years ago

Edit: Well, if the buyer money is deduct correctly, but the seller doesn't receive a penny... you could be looking for the wrong account. cause if the error was in the code, the transaction would throw an error preventing the buyer from losing money

React Store App display name:React Store SANDBOX API CREDENTIALS Sandbox account sb-gf47a952494@business.example.com Client ID


man. i just copied and paste your code and it did work. maybe there a typo somewhere in your code. see mine below.

i just put this on the cart component <V2Paypal total={total} history={history} checklist={checklist} />

and this on a separate file. some props are unused yet, just figuring out how to show the products in the invoice

export default class V2Paypal extends Component { render() { const checklist = this.props.checklist; const total = this.props.total; const history = this.props.history; return ( <PayPalButton amount={total} onSuccess={(details, data) => { console.log("onSuccess: details=", details); console.log("onSuccess: data=", data); }} options={{ clientId: process.env.REACT_APP_APP_ID }} onCancel={(data) => alert(data)} onError={(err) => alert(err)} /> ); } }

console

works

OlegSuncrown commented 4 years ago

Can be "pending" of payment, so it doesn't show updated balance until you press "approve payment" in your sandbox paypal account