PayPal create_order_error cannot read properties of null

I’ve integrated PayPal into my .NET 6 (Blazor) application. I followed the PayPal docs here to add the button. In test mode all worked fine. Now that I’ve changed the clientid to live I get an error:

create_order_error Cannot read properties of null

enter image description here

I can see the token is null, but I’m not sure what to do about it?

The code I’m using to create the order is here:

    // Style the button
    style: {

    // Called when the button is clicked
    onClick: function (data, actions) {

    // Sets up the transaction when a payment button is clicked
    createOrder: function (data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: document.getElementById('p-amount').value,

    // Finalize the transaction after payer approval
    onApprove: function (data, actions) {

    onError: function () {

I have searched for this error but it didn’t generate any results. Any help on how to resolve this is much appreciated.

>Solution :


Is null. Make it be something that’s not null.

Leave a Reply