• Resolved larsnobel

    (@larsnobel)


    Fatal error: Uncaught (Status 400) (Request req_vQhqevATh78IqQ) You cannot use line_items.amount, line_items.currency, line_items.name, line_items.description, or line_items.images in this API version. Please use line_items.price or line_items.price_data. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information. thrown in /var/www/papas.dk/hjallerup/wp-content/plugins/seatreg/php/libs/stripe-php/lib/Exception/ApiErrorException.php on line 38

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter larsnobel

    (@larsnobel)

    It’s extremely poorly documented, but it turns out you can change the Stripe API version to any version you want on a per-request basis by setting Stripe.api_version = ‘YYYY-MM-DD’ before sending a request using the Ruby bindings (https://stripe.com/docs/api/ruby#versioning), or by sending a Stripe-Version HTTP header.

    So we’ll plan to configure our specs to use the latest API version for all requests, and test for breakage that way.

    Thread Starter larsnobel

    (@larsnobel)

    
    invalid_request_error
    You cannot use line_items.amount, line_items.currency, line_items.name, line_items.description, or line_items.images in this API version. Please use line_items.price or line_items.price_data. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information.
    
    Was this useful?
    
    Yes
    
    No
    {
      "payment_intent_data": {
        "metadata": {
          "booking_id": "6800c3691d2696e73fec99c018e9bd84d1b7e290"
        }
      },
      "mode": "payment",
      "line_items": {
        "0": {
          "price_data": {
            "unit_amount": "300",
            "currency": "DKK",
            "product_data": {
              "metadata": {
                "booking_id": "6800c3691d2696e73fec99c018e9bd84d1b7e290"
              },
              "name": "Hjallerup Marked"
            }
          },
          "description": "Booking 6800c3691d2696e73fec99c018e9bd84d1b7e290",
          "quantity": "1"
        }
      },
      "cancel_url": "https://hjallerup.papas.dk?seatreg=booking-status&registration=e4cb967183&id=6800c3691d2696e73fec99c018e9bd84d1b7e290",
      "success_url": "https://hjallerup.papas.dk?seatreg=payment-return&id=6800c3691d2696e73fec99c018e9bd84d1b7e290"
    }
    Response body
    {
      "error": {
        "message": "You cannot use <code>line_items.amount</code>, <code>line_items.currency</code>, <code>line_items.name</code>, <code>line_items.description</code>, or <code>line_items.images</code> in this API version. Please use <code>line_items.price</code> or <code>line_items.price_data</code>. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information.",
        "type": "invalid_request_error"
      }
    }
    Request POST body
    {
      "payment_intent_data": {
        "metadata": {
          "booking_id": "6800c3691d2696e73fec99c018e9bd84d1b7e290"
        }
      },
      "mode": "payment",
      "line_items": {
        "0": {
          "price_data": {
            "unit_amount": "300",
            "currency": "DKK",
            "product_data": {
              "metadata": {
                "booking_id": "6800c3691d2696e73fec99c018e9bd84d1b7e290"
              },
              "name": "Hjallerup Marked"
            }
          },
          "description": "Booking 6800c3691d2696e73fec99c018e9bd84d1b7e290",
          "quantity": "1"
        }
      },
      "cancel_url": "https://hjallerup.papas.dk?seatreg=booking-status&registration=e4cb967183&id=6800c3691d2696e73fec99c018e9bd84d1b7e290",
      "success_url": "https://hjallerup.papas.dk?seatreg=payment-return&id=6800c3691d2696e73fec99c018e9bd84d1b7e290"
    }
    
    • This reply was modified 2 years, 1 month ago by Yui.
    • This reply was modified 2 years, 1 month ago by Yui. Reason: formatting
    Thread Starter larsnobel

    (@larsnobel)

    Plugin Author thesiim

    (@thesiim)

    Thank you for notifying about the issue. I will take a look as soon as I have some time.

    Thread Starter larsnobel

    (@larsnobel)

    Nps.

    I added:
    \Stripe\Stripe::setApiVersion( ‘2020-08-27’);

    To the following file:
    seatreg/php/payment/stripe/create-checkout-session.php

    And now get the error:
    Fatal error: Uncaught (Status 400) (Request req_x3iEIHmDT0yrSG) The Checkout Session’s total amount must convert to at least 50 cents. 3.00 kr converts to approximately a??0.40. thrown in /var/www/papas.dk/hjallerup/wp-content/plugins/seatreg/php/libs/stripe-php/lib/Exception/ApiErrorException.php on line 38

    Hopefully thats useful information. Im not THAT good with coding, but i understand the basics ??

    Thread Starter larsnobel

    (@larsnobel)

    Adding \Stripe\Stripe::setApiVersion( ‘2020-08-27’); to the file actually worked when i made the price a bit higher than 3DKK

    might be a simple solution

    Thread Starter larsnobel

    (@larsnobel)

    So now i made the price 10DKK with the \Stripe\Stripe::setApiVersion( ‘2020-08-27’); line added to the file and i can actually do the payment now. However, when i mark the box “set approved” its not automaticly approving the booking when payed.

    View post on imgur.com

    Plugin Author thesiim

    (@thesiim)

    I published a new version of the plugin. 1.26.1 should fix the Stripe API issue + the automatic approving should work now.

    Plugin Author thesiim

    (@thesiim)

    Let me know if it helped

    Thread Starter larsnobel

    (@larsnobel)

    API version worked like a charm now.

    However it does not automaticly get approved on the payment.

    Heres a video showing my procedure: https://youtu.be/2PvVZ3HSgOU

    So basicly, the timer stops (the red text in the mail saying xx minutes left to do the payment), but it says “Your payment is being processed” and the booking is not moved into the approved tap in the plugin.

    Nor do i get an email saying that my booking was approved.

    Btw i really appreciate your help and im asking my boss if we can make a donation tomorrow.

    • This reply was modified 2 years, 1 month ago by larsnobel.
    Plugin Author thesiim

    (@thesiim)

    I have an idea. Can you do the following:
    In your registration settings turn Stripe payments off and save. Then turn on and save again. That updates Stripe payment webhooks. I have a feeling that for some reason you lost Stripe webhook. You can also check if webhook exists in https://dashboard.stripe.com/test/webhooks
    There should be a webhook with url to your site that ends with ?seatreg=stripe-webhook-callback

    Thread Starter larsnobel

    (@larsnobel)

    Tried turning it off and on. Getting the following error:

    Fatal error: Uncaught (Status 400) (Request req_nMeMSH2YHtu3ev) Invalid URL: https://hjallerup.papas.dk?seatreg=stripe-webhook-callback. URLs in livemode must begin with “https://&#8221; thrown in /var/www/papas.dk/hjallerup/wp-content/plugins/seatreg/php/libs/stripe-php/lib/Exception/ApiErrorException.php on line 38

    Im running on http atm. Going https now and see if that fix it

    Thread Starter larsnobel

    (@larsnobel)

    Now im not getting the error anymore (after moving to https), but i still have the same problem. “Your payment is being processed” and the booking is stuck on “pending”.

    View post on imgur.com

    I added this webhook manually and that is still not working. Does it have something to do with the API version?

    Thread Starter larsnobel

    (@larsnobel)

    View post on imgur.com

    {
    “id”: “evt_3LpS06EqzkoLN3NU1xD8fQrD”,
    “object”: “event”,
    “api_version”: “2022-08-01”,
    “created”: 1664954802,
    “data”: {
    “object”: {
    “id”: “pi_3LpS06EqzkoLN3NU1MFii2i7”,
    “object”: “payment_intent”,
    “amount”: 1000,
    “amount_capturable”: 0,
    “amount_details”: {
    “tip”: {
    }
    },
    “amount_received”: 0,
    “application”: null,
    “application_fee_amount”: null,
    “automatic_payment_methods”: null,
    “canceled_at”: null,
    “cancellation_reason”: null,
    “capture_method”: “automatic”,
    “charges”: {
    “object”: “list”,
    “data”: [
    ],
    “has_more”: false,
    “total_count”: 0,
    “url”: “/v1/charges?payment_intent=pi_3LpS06EqzkoLN3NU1MFii2i7”
    },
    “client_secret”: “pi_3LpS06EqzkoLN3NU1MFii2i7_secret_EUA7eBGyUPMrYQLeCOytGsyn2”,
    “confirmation_method”: “automatic”,
    “created”: 1664954802,
    “currency”: “dkk”,
    “customer”: null,
    “description”: null,
    “invoice”: null,
    “last_payment_error”: null,
    “livemode”: false,
    “metadata”: {
    “booking_id”: “624a77a2f1a861cec2d923937478dd8ffbca4bd6”
    },
    “next_action”: null,
    “on_behalf_of”: null,
    “payment_method”: null,
    “payment_method_options”: {
    “card”: {
    “installments”: null,
    “mandate_options”: null,
    “network”: null,
    “request_three_d_secure”: “automatic”
    }
    },
    “payment_method_types”: [
    “card”
    ],
    “processing”: null,
    “receipt_email”: null,
    “review”: null,
    “setup_future_usage”: null,
    “shipping”: null,
    “source”: null,
    “statement_descriptor”: null,
    “statement_descriptor_suffix”: null,
    “status”: “requires_payment_method”,
    “transfer_data”: null,
    “transfer_group”: null
    }
    },
    “livemode”: false,
    “pending_webhooks”: 1,
    “request”: {
    “id”: “req_AuNWHHQmCqlWtD”,
    “idempotency_key”: “2c3868a3-efc9-48a2-b0fb-f82ae808b209”
    },
    “type”: “payment_intent.created”
    }

    Thread Starter larsnobel

    (@larsnobel)

    Changing to my other Stripe Account using the old API version on the webhooks worked.

    I think the API for the webhooks needs to made backward compatible aswell.

    Best regards
    Lars

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Error’ is closed to new replies.