Re: [stripe-api-discuss] Stripe CLI stripe payment_methods create --type=afterpay_clearpay Missing required param: billing_details[address][line1]

590 views
Skip to first unread message
Message has been deleted

Remi J.

unread,
Jun 27, 2021, 2:23:02 AM6/27/21
to Stripe API Discussion
Hello,

Accepting a payment via Afterpay Clearpay requires collecting billing details upfront. This means that when you create the PaymentMethod you have to pass that information like this:

 stripe payment_methods create --type=afterpay_clearpay -d "billing_details[address][line1]=aaaa" -d "billing_details[address][postal_code]=11111" -d "billing_details[address][country]=US" -d "billing_details[name]=US" -d "billing_details[email]=te...@example.com"

Hope this helps!
Remi

On Sun, Jun 27, 2021 at 8:21 AM Carpy Tackle <carpy...@gmail.com> wrote:

I'm trying to enable afterpay_clearpay as payment method via Stripe via CLI

I'm unsure of the format required to successfully add the new payment method and wondered if anyone has done this before? This is what i'm getting below

stripe payment_methods create --type=afterpay_clearpay

Response

{ "error": { "code": "parameter_missing", "doc_url": "https://stripe.com/docs/error-codes/parameter-missing", "message": "Missing required param: billing_details[address][line1].", "param": "billing_details[address][line1]", "type": "invalid_request_error" } }

Many Thanks for any pointers

--
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
Message has been deleted

Remi J.

unread,
Jun 27, 2021, 2:18:36 PM6/27/21
to Carpy Tackle, Stripe API Discussion
That parameter is an array so you have to pass each value separately so it'd look like this:

 stripe checkout sessions create \
  --success-url="https://example.com/success" \
  --cancel-url="https://example.com/cancel" \
  -d "payment_method_types[]"=card \
  -d "line_items[0][price]"=price_ABC \
  -d "line_items[0][quantity]"=1 \
  --mode=payment \
  -d "shipping_address_collection[allowed_countries][]"=AU \
  -d "shipping_address_collection[allowed_countries][]"=US

Hope this helps!

On Sun, Jun 27, 2021 at 10:58 AM Carpy Tackle <carpy...@gmail.com> wrote:
Thanks Remi that's great, one last question.

When create a checkout session with afterpay, I need to Collect shipping addresses by adding your country to shipping_address_collection[allowed_countries]

I'm unsure of the CLI format required i.e.

-d "shipping_address_collection[][allowed_countries]"='AU','NZ' --mode=payment

{
  "error": {
    "message": "Invalid array",
    "param": "shipping_address_collection[allowed_countries]",
    "type": "invalid_request_error"
  }
}

Reply all
Reply to author
Forward
0 new messages