stripe-ruby-mock 2.5.8 → 3.1.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.travis.yml +6 -9
  4. data/CHANGELOG.md +41 -0
  5. data/Gemfile +1 -0
  6. data/README.md +17 -11
  7. data/lib/stripe_mock.rb +8 -0
  8. data/lib/stripe_mock/api/client.rb +1 -1
  9. data/lib/stripe_mock/api/errors.rb +34 -28
  10. data/lib/stripe_mock/api/instance.rb +1 -1
  11. data/lib/stripe_mock/api/webhooks.rb +5 -0
  12. data/lib/stripe_mock/client.rb +2 -1
  13. data/lib/stripe_mock/data.rb +285 -16
  14. data/lib/stripe_mock/data/list.rb +42 -9
  15. data/lib/stripe_mock/instance.rb +18 -4
  16. data/lib/stripe_mock/request_handlers/account_links.rb +15 -0
  17. data/lib/stripe_mock/request_handlers/balance_transactions.rb +2 -2
  18. data/lib/stripe_mock/request_handlers/charges.rb +6 -4
  19. data/lib/stripe_mock/request_handlers/checkout.rb +15 -0
  20. data/lib/stripe_mock/request_handlers/checkout_session.rb +22 -0
  21. data/lib/stripe_mock/request_handlers/customers.rb +35 -18
  22. data/lib/stripe_mock/request_handlers/ephemeral_key.rb +1 -1
  23. data/lib/stripe_mock/request_handlers/express_login_links.rb +15 -0
  24. data/lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb +5 -0
  25. data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +12 -7
  26. data/lib/stripe_mock/request_handlers/helpers/token_helpers.rb +1 -1
  27. data/lib/stripe_mock/request_handlers/invoices.rb +10 -4
  28. data/lib/stripe_mock/request_handlers/payment_intents.rb +182 -0
  29. data/lib/stripe_mock/request_handlers/payment_methods.rb +120 -0
  30. data/lib/stripe_mock/request_handlers/plans.rb +1 -1
  31. data/lib/stripe_mock/request_handlers/prices.rb +44 -0
  32. data/lib/stripe_mock/request_handlers/products.rb +1 -0
  33. data/lib/stripe_mock/request_handlers/setup_intents.rb +93 -0
  34. data/lib/stripe_mock/request_handlers/sources.rb +12 -6
  35. data/lib/stripe_mock/request_handlers/subscriptions.rb +45 -22
  36. data/lib/stripe_mock/request_handlers/tokens.rb +6 -4
  37. data/lib/stripe_mock/request_handlers/validators/param_validators.rb +123 -9
  38. data/lib/stripe_mock/server.rb +2 -2
  39. data/lib/stripe_mock/test_strategies/base.rb +67 -8
  40. data/lib/stripe_mock/test_strategies/live.rb +23 -12
  41. data/lib/stripe_mock/test_strategies/mock.rb +6 -2
  42. data/lib/stripe_mock/version.rb +1 -1
  43. data/lib/stripe_mock/webhook_fixtures/balance.available.json +6 -0
  44. data/lib/stripe_mock/webhook_fixtures/charge.failed.json +166 -38
  45. data/lib/stripe_mock/webhook_fixtures/customer.created.json +1 -0
  46. data/lib/stripe_mock/webhook_fixtures/customer.updated.json +1 -0
  47. data/lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json +186 -0
  48. data/lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json +164 -0
  49. data/lib/stripe_mock/webhook_fixtures/product.created.json +34 -0
  50. data/lib/stripe_mock/webhook_fixtures/product.deleted.json +34 -0
  51. data/lib/stripe_mock/webhook_fixtures/product.updated.json +38 -0
  52. data/spec/instance_spec.rb +10 -12
  53. data/spec/list_spec.rb +38 -0
  54. data/spec/server_spec.rb +6 -3
  55. data/spec/shared_stripe_examples/account_examples.rb +1 -1
  56. data/spec/shared_stripe_examples/account_link_examples.rb +16 -0
  57. data/spec/shared_stripe_examples/balance_examples.rb +6 -0
  58. data/spec/shared_stripe_examples/balance_transaction_examples.rb +3 -3
  59. data/spec/shared_stripe_examples/bank_examples.rb +3 -3
  60. data/spec/shared_stripe_examples/card_examples.rb +4 -4
  61. data/spec/shared_stripe_examples/card_token_examples.rb +17 -21
  62. data/spec/shared_stripe_examples/charge_examples.rb +9 -22
  63. data/spec/shared_stripe_examples/checkout_examples.rb +47 -0
  64. data/spec/shared_stripe_examples/coupon_examples.rb +1 -1
  65. data/spec/shared_stripe_examples/customer_examples.rb +93 -53
  66. data/spec/shared_stripe_examples/dispute_examples.rb +2 -2
  67. data/spec/shared_stripe_examples/error_mock_examples.rb +8 -7
  68. data/spec/shared_stripe_examples/express_login_link_examples.rb +12 -0
  69. data/spec/shared_stripe_examples/external_account_examples.rb +3 -3
  70. data/spec/shared_stripe_examples/invoice_examples.rb +41 -39
  71. data/spec/shared_stripe_examples/invoice_item_examples.rb +1 -1
  72. data/spec/shared_stripe_examples/payment_intent_examples.rb +147 -0
  73. data/spec/shared_stripe_examples/payment_method_examples.rb +449 -0
  74. data/spec/shared_stripe_examples/payout_examples.rb +2 -2
  75. data/spec/shared_stripe_examples/plan_examples.rb +135 -92
  76. data/spec/shared_stripe_examples/price_examples.rb +183 -0
  77. data/spec/shared_stripe_examples/product_examples.rb +147 -0
  78. data/spec/shared_stripe_examples/refund_examples.rb +25 -21
  79. data/spec/shared_stripe_examples/setup_intent_examples.rb +68 -0
  80. data/spec/shared_stripe_examples/subscription_examples.rb +430 -318
  81. data/spec/shared_stripe_examples/subscription_items_examples.rb +3 -2
  82. data/spec/shared_stripe_examples/transfer_examples.rb +6 -6
  83. data/spec/shared_stripe_examples/webhook_event_examples.rb +11 -11
  84. data/spec/spec_helper.rb +7 -4
  85. data/spec/stripe_mock_spec.rb +4 -4
  86. data/spec/support/shared_contexts/stripe_validator_spec.rb +8 -0
  87. data/spec/support/stripe_examples.rb +9 -1
  88. data/stripe-ruby-mock.gemspec +8 -3
  89. metadata +72 -34
  90. data/spec/shared_stripe_examples/product_example.rb +0 -65
@@ -2,19 +2,59 @@ module StripeMock
2
2
  module TestStrategies
3
3
  class Base
4
4
 
5
+ def list_products(limit)
6
+ Stripe::Product.list(limit: limit)
7
+ end
8
+
9
+ def create_product(params = {})
10
+ Stripe::Product.create create_product_params(params)
11
+ end
12
+
13
+ def create_product_params(params={})
14
+ {
15
+ :id => 'stripe_mock_default_product_id',
16
+ :name => 'Default Product',
17
+ }.merge(params)
18
+ end
19
+
20
+ def retrieve_product(product_id)
21
+ Stripe::Product.retrieve(product_id)
22
+ end
23
+
24
+
25
+ def list_plans(limit)
26
+ Stripe::Plan.list(limit: limit)
27
+ end
28
+
29
+ def create_plan(params={})
30
+ Stripe::Plan.create create_plan_params(params)
31
+ end
32
+
5
33
  def create_plan_params(params={})
6
- currency = params[:currency] || StripeMock.default_currency
7
34
  {
8
35
  :id => 'stripe_mock_default_plan_id',
9
- :product => {
10
- :name => 'StripeMock Default Plan ID'
11
- },
12
- :amount => 1337,
13
- :currency => currency,
14
- :interval => 'month'
36
+ :interval => 'month',
37
+ :currency => StripeMock.default_currency,
38
+ :product => nil, # need to override yourself to pass validations
39
+ :amount => 1337
15
40
  }.merge(params)
16
41
  end
17
42
 
43
+ def create_price(params={})
44
+ Stripe::Price.create create_price_params(params)
45
+ end
46
+
47
+ def create_price_params(params={})
48
+ {
49
+ :currency => StripeMock.default_currency,
50
+ }.merge(params)
51
+ end
52
+
53
+ def list_subscriptions(limit)
54
+ Stripe::Subscription.list(limit: limit)
55
+ end
56
+
57
+
18
58
  def generate_card_token(card_params={})
19
59
  card_data = { :number => "4242424242424242", :exp_month => 9, :exp_year => (Time.now.year + 5), :cvc => "999", :tokenization_method => nil }
20
60
  card = StripeMock::Util.card_merge(card_data, card_params)
@@ -40,6 +80,7 @@ module StripeMock
40
80
  stripe_token.id
41
81
  end
42
82
 
83
+
43
84
  def create_coupon_params(params = {})
44
85
  currency = params[:currency] || StripeMock.default_currency
45
86
  {
@@ -64,18 +105,36 @@ module StripeMock
64
105
  }.merge(params)
65
106
  end
66
107
 
108
+ def create_checkout_session_params(params = {})
109
+ {
110
+ payment_method_types: ['card'],
111
+ line_items: [{
112
+ name: 'T-shirt',
113
+ quantity: 1,
114
+ amount: 500,
115
+ currency: 'usd',
116
+ }],
117
+ }.merge(params)
118
+ end
119
+
120
+
67
121
  def create_coupon(params = {})
68
122
  Stripe::Coupon.create create_coupon_params(params)
69
123
  end
70
124
 
125
+ def create_checkout_session(params = {})
126
+ Stripe::Checkout::Session.create create_checkout_session_params(params)
127
+ end
128
+
71
129
  def delete_all_coupons
72
- coupons = Stripe::Coupon.all
130
+ coupons = Stripe::Coupon.list
73
131
  coupons.data.map(&:delete) if coupons.data.count > 0
74
132
  end
75
133
 
76
134
  def prepare_card_error
77
135
  StripeMock.prepare_card_error(:card_error, :new_customer) if StripeMock.state == 'local'
78
136
  end
137
+
79
138
  end
80
139
  end
81
140
  end
@@ -2,6 +2,21 @@ module StripeMock
2
2
  module TestStrategies
3
3
  class Live < Base
4
4
 
5
+ def create_product(params={})
6
+ params = create_product_params(params)
7
+ raise "create_product requires an :id" if params[:id].nil?
8
+ delete_product(params[:id])
9
+ Stripe::Product.create params
10
+ end
11
+
12
+ def delete_product(product_id)
13
+ product = Stripe::Product.retrieve(product_id)
14
+ Stripe::Plan.list(product: product_id).each(&:delete) if product.type == 'service'
15
+ product.delete
16
+ rescue Stripe::StripeError => e
17
+ # do nothing
18
+ end
19
+
5
20
  def create_plan(params={})
6
21
  raise "create_plan requires an :id" if params[:id].nil?
7
22
  delete_plan(params[:id])
@@ -9,12 +24,10 @@ module StripeMock
9
24
  end
10
25
 
11
26
  def delete_plan(plan_id)
12
- begin
13
- plan = Stripe::Plan.retrieve(plan_id)
14
- plan.delete
15
- rescue Stripe::StripeError => e
16
- # Do nothing; we just want to make sure this plan ceases to exists
17
- end
27
+ plan = Stripe::Plan.retrieve(plan_id)
28
+ plan.delete
29
+ rescue Stripe::StripeError => e
30
+ # do nothing
18
31
  end
19
32
 
20
33
  def create_coupon(params={})
@@ -23,12 +36,10 @@ module StripeMock
23
36
  end
24
37
 
25
38
  def delete_coupon(id)
26
- begin
27
- coupon = Stripe::Coupon.retrieve(id)
28
- coupon.delete
29
- rescue Stripe::StripeError
30
- # do nothing
31
- end
39
+ coupon = Stripe::Coupon.retrieve(id)
40
+ coupon.delete
41
+ rescue Stripe::StripeError
42
+ # do nothing
32
43
  end
33
44
 
34
45
  def upsert_stripe_object(object, attributes)
@@ -2,8 +2,12 @@ module StripeMock
2
2
  module TestStrategies
3
3
  class Mock < Base
4
4
 
5
- def create_plan(params={})
6
- Stripe::Plan.create create_plan_params(params)
5
+ def delete_product(product_id)
6
+ if StripeMock.state == 'remote'
7
+ StripeMock.client.destroy_resource('products', product_id)
8
+ elsif StripeMock.state == 'local'
9
+ StripeMock.instance.products.delete(product_id)
10
+ end
7
11
  end
8
12
 
9
13
  def delete_plan(plan_id)
@@ -1,4 +1,4 @@
1
1
  module StripeMock
2
2
  # stripe-ruby-mock version
3
- VERSION = "2.5.8"
3
+ VERSION = "3.1.0.rc3"
4
4
  end
@@ -18,6 +18,12 @@
18
18
  "currency": "usd"
19
19
  }
20
20
  ],
21
+ "instant_available": [
22
+ {
23
+ "amount": 0,
24
+ "currency": "usd"
25
+ }
26
+ ],
21
27
  "livemode": false,
22
28
  "object": "balance"
23
29
  }
@@ -4,53 +4,181 @@
4
4
  "id": "evt_00000000000000",
5
5
  "type": "charge.failed",
6
6
  "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-02-28",
7
10
  "data": {
8
11
  "object": {
9
12
  "id": "ch_00000000000000",
10
13
  "object": "charge",
11
- "created": 1380933505,
14
+ "amount": 100,
15
+ "amount_refunded": 0,
16
+ "application": null,
17
+ "application_fee": null,
18
+ "application_fee_amount": null,
19
+ "balance_transaction": "txn_00000000000000",
20
+ "billing_details": {
21
+ "address": {
22
+ "city": null,
23
+ "country": null,
24
+ "line1": null,
25
+ "line2": null,
26
+ "postal_code": null,
27
+ "state": null
28
+ },
29
+ "email": null,
30
+ "name": "Jenny Rosen",
31
+ "phone": null
32
+ },
33
+ "captured": false,
34
+ "created": 1572389205,
35
+ "currency": "cad",
36
+ "customer": null,
37
+ "description": "My First Test Charge (created for API docs)",
38
+ "dispute": null,
39
+ "failure_code": null,
40
+ "failure_message": null,
41
+ "fraud_details": {},
42
+ "invoice": null,
12
43
  "livemode": false,
44
+ "metadata": {},
45
+ "on_behalf_of": null,
46
+ "order": null,
47
+ "outcome": null,
13
48
  "paid": false,
14
- "amount": 1000,
15
- "currency": "usd",
16
- "refunded": false,
17
- "source": {
18
- "id": "cc_00000000000000",
19
- "object": "card",
20
- "last4": "4242",
21
- "type": "Visa",
22
- "brand": "Visa",
23
- "funding": "credit",
24
- "exp_month": 12,
25
- "exp_year": 2013,
26
- "fingerprint": "wXWJT135mEK107G8",
27
- "customer": "cus_00000000000000",
28
- "country": "US",
29
- "name": "Actual Nothing",
30
- "address_line1": null,
31
- "address_line2": null,
32
- "address_city": null,
33
- "address_state": null,
34
- "address_zip": null,
35
- "address_country": null,
36
- "cvc_check": null,
37
- "address_line1_check": null,
38
- "address_zip_check": null
49
+ "payment_intent": null,
50
+ "payment_method": "card_00000000000000",
51
+ "payment_method_details": {
52
+ "card": {
53
+ "brand": "visa",
54
+ "checks": {
55
+ "address_line1_check": null,
56
+ "address_postal_code_check": null,
57
+ "cvc_check": null
58
+ },
59
+ "country": "US",
60
+ "exp_month": 8,
61
+ "exp_year": 2019,
62
+ "fingerprint": "C8aRpBae2T8GeJcn",
63
+ "funding": "credit",
64
+ "installments": null,
65
+ "last4": "4242",
66
+ "network": "visa",
67
+ "three_d_secure": null,
68
+ "wallet": null
69
+ },
70
+ "type": "card"
39
71
  },
40
- "captured": true,
72
+ "receipt_email": null,
73
+ "receipt_number": null,
74
+ "receipt_url": "https://pay.stripe.com/receipts/acct_1C0lZEHvOcc4e36o/ch_1FZ3SbHsssvOcc4e36o87NHFK7i/rcpt_G5DuglJFhskXjsEDnLzxF6ESuGQe0Qj",
75
+ "refunded": false,
41
76
  "refunds": {
42
-
77
+ "object": "list",
78
+ "data": [],
79
+ "has_more": false,
80
+ "url": "/v1/charges/ch_1FZ3SbHvOcc4e36o87NHFK7i/refunds"
43
81
  },
44
- "balance_transaction": "txn_00000000000000",
45
- "failure_message": null,
46
- "failure_code": null,
47
- "amount_refunded": 0,
48
- "customer": "cus_00000000000000",
49
- "invoice": "in_00000000000000",
50
- "description": null,
51
- "dispute": null,
52
- "metadata": {
82
+ "review": null,
83
+ "shipping": null,
84
+ "source_transfer": null,
85
+ "statement_descriptor": null,
86
+ "statement_descriptor_suffix": null,
87
+ "status": "failed",
88
+ "transfer_data": null,
89
+ "transfer_group": null
90
+ }
91
+ },
92
+ "webhook": {
93
+ "created": 1326853478,
94
+ "livemode": false,
95
+ "id": "evt_00000000000000",
96
+ "type": "charge.failed",
97
+ "object": "event",
98
+ "request": null,
99
+ "pending_webhooks": 1,
100
+ "api_version": "2018-02-28",
101
+ "data": {
102
+ "object": {
103
+ "id": "ch_00000000000000",
104
+ "object": "charge",
105
+ "amount": 100,
106
+ "amount_refunded": 0,
107
+ "application": null,
108
+ "application_fee": null,
109
+ "application_fee_amount": null,
110
+ "balance_transaction": "txn_00000000000000",
111
+ "billing_details": {
112
+ "address": {
113
+ "city": null,
114
+ "country": null,
115
+ "line1": null,
116
+ "line2": null,
117
+ "postal_code": null,
118
+ "state": null
119
+ },
120
+ "email": null,
121
+ "name": "Jenny Rosen",
122
+ "phone": null
123
+ },
124
+ "captured": false,
125
+ "created": 1572389205,
126
+ "currency": "cad",
127
+ "customer": null,
128
+ "description": "My First Test Charge (created for API docs)",
129
+ "dispute": null,
130
+ "failure_code": null,
131
+ "failure_message": null,
132
+ "fraud_details": {},
133
+ "invoice": null,
134
+ "livemode": false,
135
+ "metadata": {},
136
+ "on_behalf_of": null,
137
+ "order": null,
138
+ "outcome": null,
139
+ "paid": false,
140
+ "payment_intent": null,
141
+ "payment_method": "card_00000000000000",
142
+ "payment_method_details": {
143
+ "card": {
144
+ "brand": "visa",
145
+ "checks": {
146
+ "address_line1_check": null,
147
+ "address_postal_code_check": null,
148
+ "cvc_check": null
149
+ },
150
+ "country": "US",
151
+ "exp_month": 8,
152
+ "exp_year": 2019,
153
+ "fingerprint": "C8aRpBae2T8GeJcn",
154
+ "funding": "credit",
155
+ "installments": null,
156
+ "last4": "4242",
157
+ "network": "visa",
158
+ "three_d_secure": null,
159
+ "wallet": null
160
+ },
161
+ "type": "card"
162
+ },
163
+ "receipt_email": null,
164
+ "receipt_number": null,
165
+ "receipt_url": "https://pay.stripe.com/receipts/acct_1C0lZEHvOcc4e36o/ch_1FZ3SbHvOcc4sssse36o87NHFK7i/rcpt_G5DuglJFhskXjsEDnLzxF6ESuGQe0Qj",
166
+ "refunded": false,
167
+ "refunds": {
168
+ "object": "list",
169
+ "data": [],
170
+ "has_more": false,
171
+ "url": "/v1/charges/ch_1FZ3SbHvOccssssss4e36o87NHFK7i/refunds"
172
+ },
173
+ "review": null,
174
+ "shipping": null,
175
+ "source_transfer": null,
176
+ "statement_descriptor": null,
177
+ "statement_descriptor_suffix": null,
178
+ "status": "failed",
179
+ "transfer_data": null,
180
+ "transfer_group": null
53
181
  }
54
182
  }
55
183
  }
56
- }
184
+ }
@@ -15,6 +15,7 @@
15
15
  "delinquent": true,
16
16
  "metadata": {
17
17
  },
18
+ "preferred_locales": [],
18
19
  "subscription": null,
19
20
  "discount": null,
20
21
  "account_balance": 0,
@@ -15,6 +15,7 @@
15
15
  "delinquent": true,
16
16
  "metadata": {
17
17
  },
18
+ "preferred_locales": [],
18
19
  "subscription": null,
19
20
  "discount": null,
20
21
  "account_balance": 0,
@@ -0,0 +1,186 @@
1
+ {
2
+ "id": "evt_00000000000000",
3
+ "object": "event",
4
+ "api_version": "2018-02-28",
5
+ "created": 1578401135,
6
+ "data": {
7
+ "object": {
8
+ "id": "pi_00000000000000",
9
+ "object": "payment_intent",
10
+ "allowed_source_types": ["card", "sepa_debit"],
11
+ "amount": 200,
12
+ "amount_capturable": 0,
13
+ "amount_received": 0,
14
+ "application": null,
15
+ "application_fee_amount": null,
16
+ "canceled_at": null,
17
+ "cancellation_reason": null,
18
+ "capture_method": "automatic",
19
+ "charges": {
20
+ "object": "list",
21
+ "data": [
22
+ {
23
+ "id": "py_00000000000000",
24
+ "object": "charge",
25
+ "amount": 200,
26
+ "amount_refunded": 0,
27
+ "application": null,
28
+ "application_fee": null,
29
+ "application_fee_amount": null,
30
+ "balance_transaction": null,
31
+ "billing_details": {
32
+ "address": {
33
+ "city": null,
34
+ "country": null,
35
+ "line1": null,
36
+ "line2": null,
37
+ "postal_code": null,
38
+ "state": null
39
+ },
40
+ "email": "john.doe@example.com",
41
+ "name": "John Doe",
42
+ "phone": null
43
+ },
44
+ "captured": true,
45
+ "created": 1578401129,
46
+ "currency": "eur",
47
+ "customer": "cus_00000000000000",
48
+ "description": null,
49
+ "destination": "acct_00000000000000",
50
+ "dispute": null,
51
+ "disputed": false,
52
+ "failure_code": null,
53
+ "failure_message": null,
54
+ "fraud_details": {},
55
+ "invoice": null,
56
+ "livemode": false,
57
+ "metadata": {},
58
+ "on_behalf_of": null,
59
+ "order": null,
60
+ "outcome": {
61
+ "network_status": "approved_by_network",
62
+ "reason": null,
63
+ "risk_level": "not_assessed",
64
+ "seller_message": "Payment complete.",
65
+ "type": "authorized"
66
+ },
67
+ "paid": false,
68
+ "payment_intent": "pi_00000000000000",
69
+ "payment_method": "pm_00000000000000",
70
+ "payment_method_details": {
71
+ "sepa_debit": {
72
+ "bank_code": "37040044",
73
+ "branch_code": null,
74
+ "country": "DE",
75
+ "fingerprint": "00000000000000",
76
+ "last4": "3001",
77
+ "mandate": "mandate_00000000000000"
78
+ },
79
+ "type": "sepa_debit"
80
+ },
81
+ "receipt_email": null,
82
+ "receipt_number": null,
83
+ "receipt_url": "https://pay.stripe.com/receipts/acct_00000000000000/py_00000000000000/rcpt_00000000000000",
84
+ "refunded": false,
85
+ "refunds": {
86
+ "object": "list",
87
+ "data": [],
88
+ "has_more": false,
89
+ "total_count": 0,
90
+ "url": "/v1/charges/py_00000000000000/refunds"
91
+ },
92
+ "review": null,
93
+ "shipping": null,
94
+ "source": null,
95
+ "source_transfer": null,
96
+ "statement_descriptor": "ACME Corp",
97
+ "statement_descriptor_suffix": null,
98
+ "status": "failed",
99
+ "transfer_data": {
100
+ "amount": null,
101
+ "destination": "acct_00000000000000"
102
+ },
103
+ "transfer_group": "group_pi_00000000000000"
104
+ }
105
+ ],
106
+ "has_more": false,
107
+ "total_count": 1,
108
+ "url": "/v1/charges?payment_intent=pi_00000000000000"
109
+ },
110
+ "client_secret": "pi_00000000000000",
111
+ "confirmation_method": "automatic",
112
+ "created": 1578401129,
113
+ "currency": "eur",
114
+ "customer": "cus_00000000000000",
115
+ "description": null,
116
+ "invoice": null,
117
+ "last_payment_error": {
118
+ "code": "payment_intent_payment_attempt_failed",
119
+ "doc_url": "https://stripe.com/docs/error-codes/payment-intent-payment-attempt-failed",
120
+ "message": "The payment failed.",
121
+ "payment_method": {
122
+ "id": "pm_00000000000000",
123
+ "object": "payment_method",
124
+ "billing_details": {
125
+ "address": {
126
+ "city": null,
127
+ "country": null,
128
+ "line1": null,
129
+ "line2": null,
130
+ "postal_code": null,
131
+ "state": null
132
+ },
133
+ "email": "john.doe@example.com",
134
+ "name": "John Doe",
135
+ "phone": null
136
+ },
137
+ "created": 1578400666,
138
+ "customer": "cus_00000000000000",
139
+ "livemode": false,
140
+ "metadata": {},
141
+ "sepa_debit": {
142
+ "bank_code": "37040044",
143
+ "branch_code": "",
144
+ "country": "DE",
145
+ "fingerprint": "00000000000000",
146
+ "last4": "3001"
147
+ },
148
+ "type": "sepa_debit"
149
+ },
150
+ "type": "invalid_request_error"
151
+ },
152
+ "livemode": false,
153
+ "metadata": {},
154
+ "next_action": null,
155
+ "next_source_action": null,
156
+ "on_behalf_of": null,
157
+ "payment_method": null,
158
+ "payment_method_options": {
159
+ "card": {
160
+ "installments": null,
161
+ "request_three_d_secure": "automatic"
162
+ }
163
+ },
164
+ "payment_method_types": ["card", "sepa_debit"],
165
+ "receipt_email": null,
166
+ "review": null,
167
+ "setup_future_usage": null,
168
+ "shipping": null,
169
+ "source": null,
170
+ "statement_descriptor": "ACME Corp",
171
+ "statement_descriptor_suffix": null,
172
+ "status": "requires_source",
173
+ "transfer_data": {
174
+ "destination": "acct_00000000000000"
175
+ },
176
+ "transfer_group": null
177
+ }
178
+ },
179
+ "livemode": false,
180
+ "pending_webhooks": 3,
181
+ "request": {
182
+ "id": null,
183
+ "idempotency_key": null
184
+ },
185
+ "type": "payment_intent.payment_failed"
186
+ }