Skip to content

Commit

Permalink
add metadata to checkout session
Browse files Browse the repository at this point in the history
  • Loading branch information
abeinstein committed Apr 24, 2020
1 parent e54dd47 commit 288202c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/stripe/checkout/session.ex
Expand Up @@ -75,6 +75,7 @@ defmodule Stripe.Session do
:display_items => list(line_item),
:livemode => boolean(),
:locale => boolean(),
:metadata => Stripe.Types.metadata(),
:mode => String.t(),
:payment_intent => Stripe.id() | Stripe.PaymentIntent.t() | nil,
:payment_method_types => list(String.t()),
Expand All @@ -95,6 +96,7 @@ defmodule Stripe.Session do
:display_items,
:livemode,
:locale,
:metadata,
:mode,
:payment_intent,
:payment_method_types,
Expand Down
12 changes: 12 additions & 0 deletions test/stripe/checkout/session_test.exs
Expand Up @@ -12,6 +12,18 @@ defmodule Stripe.SessionTest do
assert_stripe_requested(:post, "/v1/checkout/sessions")
end

test "is creatable with metadata" do
params = %{
cancel_url: "https://stripe.com",
payment_method_types: ["card"],
success_url: "https://stripe.com",
metadata: %{key: "value"}
}

assert {:ok, %Stripe.Session{}} = Stripe.Session.create(params)
assert_stripe_requested(:post, "/v1/checkout/sessions")
end

describe "retrieve/2" do
test "retrieves a session" do
assert {:ok, session = %Stripe.Session{}} = Stripe.Session.retrieve("cs_123")
Expand Down

0 comments on commit 288202c

Please sign in to comment.