Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
createOrder breaks paypal api

When rendering a paypal button in angular like so:

  @ViewChild("paypalRef", { static: false }) private paypalRef: ElementRef;
  renderPaypalButton() {
    this.paypalSelected = true;
    if (this.paypalButtonRendered != true) {
      paypal
        .Buttons({
          style: {
            layout: "horizontal",
            color: "white",
            label: "",
          },
          createOrder: (data, actions) => {
            return actions.order.create({
              purchase_units: [
                {
                  amount: {
                    value: "1000",
                    currency_code: "zar",
                  },
                },
              ],
            });
          },
        })
        .render(this.paypalRef.nativeElement);
    }
    this.paypalButtonRendered = true;
  }

the PayPal pop up displays for a split second and then disappears. However, as soon as I remove the createOrder function, the PayPal pop up displays as normal. I am sure there is just something I am doing wrong, but any help would be appreciated thanks.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

the PayPal pop up displays for a split second and then disappears.

In general, look at the browser Javascript console and/or Dev Tools "Network" tab log to find the reason for the error.

currency_code: "zar",

For this particular situation, we can see that this is not a PayPal API supported currency.

Generally transactions must be denominated in a common international currency such as USD instead. If the payer has a funding source in a local currency like ZAR, such as a local card, the conversion will be shown to them during checkout. You will receive the transaction currency (again, typically USD)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!