stripe-ruby-mock 2.5.8 → 4.0.0
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.
- checksums.yaml +5 -5
- data/.github/workflows/rspec_tests.yml +38 -0
- data/.gitignore +1 -1
- data/.rspec +2 -1
- data/CHANGELOG.md +77 -0
- data/Gemfile +1 -5
- data/README.md +19 -11
- data/lib/stripe_mock/api/client.rb +2 -2
- data/lib/stripe_mock/api/errors.rb +34 -28
- data/lib/stripe_mock/api/instance.rb +1 -1
- data/lib/stripe_mock/api/webhooks.rb +68 -24
- data/lib/stripe_mock/client.rb +2 -1
- data/lib/stripe_mock/data/list.rb +42 -9
- data/lib/stripe_mock/data.rb +359 -21
- data/lib/stripe_mock/instance.rb +23 -5
- data/lib/stripe_mock/request_handlers/account_links.rb +15 -0
- data/lib/stripe_mock/request_handlers/accounts.rb +17 -6
- data/lib/stripe_mock/request_handlers/balance_transactions.rb +2 -2
- data/lib/stripe_mock/request_handlers/charges.rb +31 -5
- data/lib/stripe_mock/request_handlers/checkout_session.rb +179 -0
- data/lib/stripe_mock/request_handlers/customers.rb +47 -19
- data/lib/stripe_mock/request_handlers/ephemeral_key.rb +1 -1
- data/lib/stripe_mock/request_handlers/events.rb +30 -3
- data/lib/stripe_mock/request_handlers/express_login_links.rb +15 -0
- data/lib/stripe_mock/request_handlers/helpers/coupon_helpers.rb +6 -0
- data/lib/stripe_mock/request_handlers/helpers/search_helpers.rb +67 -0
- data/lib/stripe_mock/request_handlers/helpers/subscription_helpers.rb +36 -12
- data/lib/stripe_mock/request_handlers/helpers/token_helpers.rb +1 -1
- data/lib/stripe_mock/request_handlers/invoices.rb +26 -6
- data/lib/stripe_mock/request_handlers/payment_intents.rb +202 -0
- data/lib/stripe_mock/request_handlers/payment_methods.rb +124 -0
- data/lib/stripe_mock/request_handlers/plans.rb +1 -1
- data/lib/stripe_mock/request_handlers/prices.rb +71 -0
- data/lib/stripe_mock/request_handlers/products.rb +15 -5
- data/lib/stripe_mock/request_handlers/promotion_codes.rb +43 -0
- data/lib/stripe_mock/request_handlers/refunds.rb +13 -2
- data/lib/stripe_mock/request_handlers/setup_intents.rb +100 -0
- data/lib/stripe_mock/request_handlers/sources.rb +12 -6
- data/lib/stripe_mock/request_handlers/subscriptions.rb +146 -25
- data/lib/stripe_mock/request_handlers/tokens.rb +6 -4
- data/lib/stripe_mock/request_handlers/transfers.rb +12 -1
- data/lib/stripe_mock/request_handlers/validators/param_validators.rb +124 -9
- data/lib/stripe_mock/server.rb +2 -2
- data/lib/stripe_mock/test_strategies/base.rb +98 -12
- data/lib/stripe_mock/test_strategies/live.rb +23 -12
- data/lib/stripe_mock/test_strategies/mock.rb +6 -2
- data/lib/stripe_mock/version.rb +1 -1
- data/lib/stripe_mock/webhook_fixtures/account.updated.json +1 -1
- data/lib/stripe_mock/webhook_fixtures/balance.available.json +27 -15
- data/lib/stripe_mock/webhook_fixtures/charge.captured.json +143 -0
- data/lib/stripe_mock/webhook_fixtures/charge.dispute.created.json +63 -16
- data/lib/stripe_mock/webhook_fixtures/charge.failed.json +101 -44
- data/lib/stripe_mock/webhook_fixtures/charge.refund.updated.json +35 -0
- data/lib/stripe_mock/webhook_fixtures/charge.refunded.json +145 -50
- data/lib/stripe_mock/webhook_fixtures/charge.succeeded.json +114 -43
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.json +79 -0
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.payment_mode.json +53 -0
- data/lib/stripe_mock/webhook_fixtures/checkout.session.completed.setup_mode.json +45 -0
- data/lib/stripe_mock/webhook_fixtures/customer.created.json +37 -45
- data/lib/stripe_mock/webhook_fixtures/customer.deleted.json +36 -32
- data/lib/stripe_mock/webhook_fixtures/customer.source.created.json +31 -22
- data/lib/stripe_mock/webhook_fixtures/customer.source.updated.json +36 -25
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.created.json +135 -47
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.deleted.json +134 -45
- data/lib/stripe_mock/webhook_fixtures/customer.subscription.updated.json +135 -56
- data/lib/stripe_mock/webhook_fixtures/customer.updated.json +38 -46
- data/lib/stripe_mock/webhook_fixtures/invoice.created.json +176 -49
- data/lib/stripe_mock/webhook_fixtures/invoice.finalized.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.paid.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_action_required.json +171 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_failed.json +149 -83
- data/lib/stripe_mock/webhook_fixtures/invoice.payment_succeeded.json +149 -90
- data/lib/stripe_mock/webhook_fixtures/invoice.upcoming.json +70 -0
- data/lib/stripe_mock/webhook_fixtures/invoice.updated.json +178 -50
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.created.json +87 -13
- data/lib/stripe_mock/webhook_fixtures/invoiceitem.updated.json +88 -14
- data/lib/stripe_mock/webhook_fixtures/mandate.updated.json +34 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.amount_capturable_updated.json +170 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.canceled.json +73 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.created.json +86 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.payment_failed.json +225 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.processing.json +162 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.requires_action.json +191 -0
- data/lib/stripe_mock/webhook_fixtures/payment_intent.succeeded.json +196 -0
- data/lib/stripe_mock/webhook_fixtures/payment_link.created.json +47 -0
- data/lib/stripe_mock/webhook_fixtures/payment_link.updated.json +50 -0
- data/lib/stripe_mock/webhook_fixtures/payment_method.attached.json +63 -0
- data/lib/stripe_mock/webhook_fixtures/payment_method.detached.json +62 -0
- data/lib/stripe_mock/webhook_fixtures/payout.created.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/payout.paid.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/payout.updated.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/plan.created.json +30 -13
- data/lib/stripe_mock/webhook_fixtures/plan.deleted.json +30 -13
- data/lib/stripe_mock/webhook_fixtures/plan.updated.json +34 -14
- data/lib/stripe_mock/webhook_fixtures/price.created.json +42 -0
- data/lib/stripe_mock/webhook_fixtures/price.deleted.json +42 -0
- data/lib/stripe_mock/webhook_fixtures/price.updated.json +48 -0
- data/lib/stripe_mock/webhook_fixtures/product.created.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/product.deleted.json +40 -0
- data/lib/stripe_mock/webhook_fixtures/product.updated.json +47 -0
- data/lib/stripe_mock/webhook_fixtures/quote.accepted.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.canceled.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.created.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/quote.finalized.json +92 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.canceled.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.created.json +51 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.setup_failed.json +100 -0
- data/lib/stripe_mock/webhook_fixtures/setup_intent.succeeded.json +46 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.canceled.json +119 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.created.json +114 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.released.json +111 -0
- data/lib/stripe_mock/webhook_fixtures/subscription_schedule.updated.json +125 -0
- data/lib/stripe_mock/webhook_fixtures/tax_rate.created.json +32 -0
- data/lib/stripe_mock/webhook_fixtures/tax_rate.updated.json +37 -0
- data/lib/stripe_mock.rb +11 -0
- data/spec/instance_spec.rb +13 -13
- data/spec/integration_examples/completing_checkout_sessions_example.rb +37 -0
- data/spec/list_spec.rb +38 -0
- data/spec/readme_spec.rb +1 -1
- data/spec/server_spec.rb +6 -3
- data/spec/shared_stripe_examples/account_examples.rb +10 -2
- data/spec/shared_stripe_examples/account_link_examples.rb +16 -0
- data/spec/shared_stripe_examples/balance_examples.rb +6 -0
- data/spec/shared_stripe_examples/balance_transaction_examples.rb +3 -3
- data/spec/shared_stripe_examples/bank_examples.rb +3 -3
- data/spec/shared_stripe_examples/bank_token_examples.rb +5 -7
- data/spec/shared_stripe_examples/card_examples.rb +4 -4
- data/spec/shared_stripe_examples/card_token_examples.rb +17 -21
- data/spec/shared_stripe_examples/charge_examples.rb +106 -22
- data/spec/shared_stripe_examples/checkout_session_examples.rb +99 -0
- data/spec/shared_stripe_examples/coupon_examples.rb +1 -1
- data/spec/shared_stripe_examples/customer_examples.rb +149 -53
- data/spec/shared_stripe_examples/dispute_examples.rb +2 -2
- data/spec/shared_stripe_examples/error_mock_examples.rb +8 -7
- data/spec/shared_stripe_examples/express_login_link_examples.rb +12 -0
- data/spec/shared_stripe_examples/external_account_examples.rb +3 -3
- data/spec/shared_stripe_examples/invoice_examples.rb +148 -40
- data/spec/shared_stripe_examples/invoice_item_examples.rb +1 -1
- data/spec/shared_stripe_examples/payment_intent_examples.rb +283 -0
- data/spec/shared_stripe_examples/payment_method_examples.rb +454 -0
- data/spec/shared_stripe_examples/payout_examples.rb +2 -2
- data/spec/shared_stripe_examples/plan_examples.rb +135 -92
- data/spec/shared_stripe_examples/price_examples.rb +292 -0
- data/spec/shared_stripe_examples/product_examples.rb +215 -0
- data/spec/shared_stripe_examples/promotion_code_examples.rb +68 -0
- data/spec/shared_stripe_examples/refund_examples.rb +38 -21
- data/spec/shared_stripe_examples/setup_intent_examples.rb +85 -0
- data/spec/shared_stripe_examples/subscription_examples.rb +706 -324
- data/spec/shared_stripe_examples/subscription_items_examples.rb +3 -2
- data/spec/shared_stripe_examples/transfer_examples.rb +16 -7
- data/spec/shared_stripe_examples/webhook_event_examples.rb +62 -16
- data/spec/spec_helper.rb +8 -5
- data/spec/stripe_mock_spec.rb +4 -4
- data/spec/support/shared_contexts/stripe_validator_spec.rb +8 -0
- data/spec/support/stripe_examples.rb +11 -1
- data/stripe-ruby-mock.gemspec +9 -5
- metadata +115 -47
- data/.travis.yml +0 -28
- data/spec/shared_stripe_examples/product_example.rb +0 -65
@@ -2,21 +2,65 @@ module StripeMock
|
|
2
2
|
module TestStrategies
|
3
3
|
class Base
|
4
4
|
|
5
|
-
def
|
6
|
-
|
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
|
+
def list_plans(limit)
|
25
|
+
Stripe::Plan.list(limit: limit)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_plan(params = {})
|
29
|
+
Stripe::Plan.create create_plan_params(params)
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_plan_params(params = {})
|
7
33
|
{
|
8
34
|
:id => 'stripe_mock_default_plan_id',
|
9
|
-
:
|
10
|
-
|
11
|
-
|
12
|
-
:amount => 1337
|
13
|
-
:currency => currency,
|
14
|
-
:interval => 'month'
|
35
|
+
:interval => 'month',
|
36
|
+
:currency => StripeMock.default_currency,
|
37
|
+
:product => nil, # need to override yourself to pass validations
|
38
|
+
:amount => 1337
|
15
39
|
}.merge(params)
|
16
40
|
end
|
17
41
|
|
18
|
-
def
|
19
|
-
|
42
|
+
def create_price(params = {})
|
43
|
+
Stripe::Price.create create_price_params(params)
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_price_params(params = {})
|
47
|
+
price_params = {
|
48
|
+
currency: StripeMock.default_currency,
|
49
|
+
}.merge(params)
|
50
|
+
unless price_params.key?(:product) || price_params.key?(:product_data)
|
51
|
+
price_params[:product_data] = {
|
52
|
+
name: 'Product created for price'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
price_params
|
56
|
+
end
|
57
|
+
|
58
|
+
def list_subscriptions(limit)
|
59
|
+
Stripe::Subscription.list(limit: limit)
|
60
|
+
end
|
61
|
+
|
62
|
+
def generate_card_token(card_params = {})
|
63
|
+
card_data = {:number => "4242424242424242", :exp_month => 9, :exp_year => (Time.now.year + 5), :cvc => "999", :tokenization_method => nil}
|
20
64
|
card = StripeMock::Util.card_merge(card_data, card_params)
|
21
65
|
card[:fingerprint] = StripeMock::Util.fingerprint(card[:number]) if StripeMock.state == 'local'
|
22
66
|
|
@@ -24,7 +68,7 @@ module StripeMock
|
|
24
68
|
stripe_token.id
|
25
69
|
end
|
26
70
|
|
27
|
-
def generate_bank_token(bank_account_params={})
|
71
|
+
def generate_bank_token(bank_account_params = {})
|
28
72
|
currency = bank_account_params[:currency] || StripeMock.default_currency
|
29
73
|
bank_account = {
|
30
74
|
:country => "US",
|
@@ -64,18 +108,60 @@ module StripeMock
|
|
64
108
|
}.merge(params)
|
65
109
|
end
|
66
110
|
|
111
|
+
def create_checkout_session(params = {})
|
112
|
+
Stripe::Checkout::Session.create create_checkout_session_params(params)
|
113
|
+
end
|
114
|
+
|
115
|
+
def create_checkout_session_params(params = {})
|
116
|
+
{
|
117
|
+
payment_method_types: ['card'],
|
118
|
+
line_items: params[:mode] == "setup" ? nil : [{
|
119
|
+
name: 'T-shirt',
|
120
|
+
quantity: 1,
|
121
|
+
amount: 500,
|
122
|
+
currency: 'usd',
|
123
|
+
}],
|
124
|
+
cancel_url: "https://example.com/cancel",
|
125
|
+
success_url: "https://example.com/success",
|
126
|
+
}.merge(params)
|
127
|
+
end
|
128
|
+
|
129
|
+
def complete_checkout_session(session, payment_method)
|
130
|
+
session = session.is_a?(Stripe::Checkout::Session) ? session : Stripe::Checkout::Session.retrieve(session)
|
131
|
+
payment_method = payment_method.is_a?(Stripe::PaymentMethod) ? payment_method : Stripe::PaymentMethod.retrieve(payment_method)
|
132
|
+
case session.mode
|
133
|
+
when "payment"
|
134
|
+
Stripe::PaymentIntent.retrieve(session.payment_intent).confirm(payment_method: payment_method.id)
|
135
|
+
when "setup"
|
136
|
+
Stripe::SetupIntent.update(session.setup_intent, {payment_method: payment_method.id})
|
137
|
+
when "subscription"
|
138
|
+
line_items = Stripe::Checkout::Session.list_line_items(session.id)
|
139
|
+
Stripe::Subscription.create({
|
140
|
+
customer: session.customer,
|
141
|
+
items: line_items.map do |line_item|
|
142
|
+
{
|
143
|
+
price: line_item.price.id,
|
144
|
+
quantity: line_item.quantity
|
145
|
+
}
|
146
|
+
end,
|
147
|
+
default_payment_method: payment_method.id
|
148
|
+
})
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
67
152
|
def create_coupon(params = {})
|
68
153
|
Stripe::Coupon.create create_coupon_params(params)
|
69
154
|
end
|
70
155
|
|
71
156
|
def delete_all_coupons
|
72
|
-
coupons = Stripe::Coupon.
|
157
|
+
coupons = Stripe::Coupon.list
|
73
158
|
coupons.data.map(&:delete) if coupons.data.count > 0
|
74
159
|
end
|
75
160
|
|
76
161
|
def prepare_card_error
|
77
162
|
StripeMock.prepare_card_error(:card_error, :new_customer) if StripeMock.state == 'local'
|
78
163
|
end
|
164
|
+
|
79
165
|
end
|
80
166
|
end
|
81
167
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
6
|
-
|
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)
|
data/lib/stripe_mock/version.rb
CHANGED
@@ -1,25 +1,37 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"livemode": false,
|
4
|
-
"id": "evt_00000000000000",
|
5
|
-
"type": "balance.available",
|
2
|
+
"id": "evt_000000000000000000000000",
|
6
3
|
"object": "event",
|
4
|
+
"api_version": "2020-08-27",
|
5
|
+
"created": 1648319937,
|
7
6
|
"data": {
|
8
7
|
"object": {
|
9
|
-
"
|
10
|
-
{
|
11
|
-
"amount": 2217,
|
12
|
-
"currency": "usd"
|
13
|
-
}
|
14
|
-
],
|
8
|
+
"object": "balance",
|
15
9
|
"available": [
|
16
10
|
{
|
17
|
-
"amount":
|
18
|
-
"currency": "usd"
|
11
|
+
"amount": 7648,
|
12
|
+
"currency": "usd",
|
13
|
+
"source_types": {
|
14
|
+
"card": 7648
|
15
|
+
}
|
19
16
|
}
|
20
17
|
],
|
21
18
|
"livemode": false,
|
22
|
-
"
|
19
|
+
"pending": [
|
20
|
+
{
|
21
|
+
"amount": 37734,
|
22
|
+
"currency": "usd",
|
23
|
+
"source_types": {
|
24
|
+
"card": 37734
|
25
|
+
}
|
26
|
+
}
|
27
|
+
]
|
23
28
|
}
|
24
|
-
}
|
25
|
-
|
29
|
+
},
|
30
|
+
"livemode": false,
|
31
|
+
"pending_webhooks": 2,
|
32
|
+
"request": {
|
33
|
+
"id": null,
|
34
|
+
"idempotency_key": null
|
35
|
+
},
|
36
|
+
"type": "balance.available"
|
37
|
+
}
|
@@ -0,0 +1,143 @@
|
|
1
|
+
{
|
2
|
+
"id": "evt_000000000000000000000000",
|
3
|
+
"object": "event",
|
4
|
+
"api_version": "2020-08-27",
|
5
|
+
"created": 1648319938,
|
6
|
+
"data": {
|
7
|
+
"object": {
|
8
|
+
"id": "ch_000000000000000000000000",
|
9
|
+
"object": "charge",
|
10
|
+
"amount": 100,
|
11
|
+
"amount_captured": 100,
|
12
|
+
"amount_refunded": 0,
|
13
|
+
"application": null,
|
14
|
+
"application_fee": null,
|
15
|
+
"application_fee_amount": null,
|
16
|
+
"balance_transaction": "txn_000000000000000000000000",
|
17
|
+
"billing_details": {
|
18
|
+
"address": {
|
19
|
+
"city": null,
|
20
|
+
"country": null,
|
21
|
+
"line1": null,
|
22
|
+
"line2": null,
|
23
|
+
"postal_code": null,
|
24
|
+
"state": null
|
25
|
+
},
|
26
|
+
"email": null,
|
27
|
+
"name": null,
|
28
|
+
"phone": null
|
29
|
+
},
|
30
|
+
"calculated_statement_descriptor": "EXAMPLECOMPANY",
|
31
|
+
"captured": true,
|
32
|
+
"created": 1648319937,
|
33
|
+
"currency": "usd",
|
34
|
+
"customer": null,
|
35
|
+
"description": "(created by Stripe CLI)",
|
36
|
+
"destination": null,
|
37
|
+
"dispute": null,
|
38
|
+
"disputed": false,
|
39
|
+
"failure_code": null,
|
40
|
+
"failure_message": null,
|
41
|
+
"fraud_details": {
|
42
|
+
},
|
43
|
+
"invoice": null,
|
44
|
+
"livemode": false,
|
45
|
+
"metadata": {
|
46
|
+
},
|
47
|
+
"on_behalf_of": null,
|
48
|
+
"order": null,
|
49
|
+
"outcome": {
|
50
|
+
"network_status": "approved_by_network",
|
51
|
+
"reason": null,
|
52
|
+
"risk_level": "normal",
|
53
|
+
"risk_score": 64,
|
54
|
+
"seller_message": "Payment complete.",
|
55
|
+
"type": "authorized"
|
56
|
+
},
|
57
|
+
"paid": true,
|
58
|
+
"payment_intent": null,
|
59
|
+
"payment_method": "card_000000000000000000000000",
|
60
|
+
"payment_method_details": {
|
61
|
+
"card": {
|
62
|
+
"brand": "visa",
|
63
|
+
"checks": {
|
64
|
+
"address_line1_check": null,
|
65
|
+
"address_postal_code_check": null,
|
66
|
+
"cvc_check": null
|
67
|
+
},
|
68
|
+
"country": "US",
|
69
|
+
"exp_month": 3,
|
70
|
+
"exp_year": 2023,
|
71
|
+
"fingerprint": "ZoVSX2dK5igWt2SB",
|
72
|
+
"funding": "credit",
|
73
|
+
"installments": null,
|
74
|
+
"last4": "4242",
|
75
|
+
"mandate": null,
|
76
|
+
"network": "visa",
|
77
|
+
"three_d_secure": null,
|
78
|
+
"wallet": null
|
79
|
+
},
|
80
|
+
"type": "card"
|
81
|
+
},
|
82
|
+
"receipt_email": null,
|
83
|
+
"receipt_number": null,
|
84
|
+
"receipt_url": "https://pay.stripe.com/receipts/acct_0000000000000000/ch_000000000000000000000000/rcpt_0000000000000000000000000000000",
|
85
|
+
"refunded": false,
|
86
|
+
"refunds": {
|
87
|
+
"object": "list",
|
88
|
+
"data": [
|
89
|
+
|
90
|
+
],
|
91
|
+
"has_more": false,
|
92
|
+
"total_count": 0,
|
93
|
+
"url": "/v1/charges/ch_000000000000000000000000/refunds"
|
94
|
+
},
|
95
|
+
"review": null,
|
96
|
+
"shipping": null,
|
97
|
+
"source": {
|
98
|
+
"id": "card_000000000000000000000000",
|
99
|
+
"object": "card",
|
100
|
+
"address_city": null,
|
101
|
+
"address_country": null,
|
102
|
+
"address_line1": null,
|
103
|
+
"address_line1_check": null,
|
104
|
+
"address_line2": null,
|
105
|
+
"address_state": null,
|
106
|
+
"address_zip": null,
|
107
|
+
"address_zip_check": null,
|
108
|
+
"brand": "Visa",
|
109
|
+
"country": "US",
|
110
|
+
"customer": null,
|
111
|
+
"cvc_check": null,
|
112
|
+
"dynamic_last4": null,
|
113
|
+
"exp_month": 3,
|
114
|
+
"exp_year": 2023,
|
115
|
+
"fingerprint": "ZoVSX2dK5igWt2SB",
|
116
|
+
"funding": "credit",
|
117
|
+
"last4": "4242",
|
118
|
+
"metadata": {
|
119
|
+
},
|
120
|
+
"name": null,
|
121
|
+
"tokenization_method": null
|
122
|
+
},
|
123
|
+
"source_transfer": null,
|
124
|
+
"statement_descriptor": null,
|
125
|
+
"statement_descriptor_suffix": null,
|
126
|
+
"status": "succeeded",
|
127
|
+
"transfer_data": null,
|
128
|
+
"transfer_group": null
|
129
|
+
},
|
130
|
+
"previous_attributes": {
|
131
|
+
"amount_captured": 0,
|
132
|
+
"balance_transaction": null,
|
133
|
+
"captured": false
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"livemode": false,
|
137
|
+
"pending_webhooks": 2,
|
138
|
+
"request": {
|
139
|
+
"id": "req_00000000000000",
|
140
|
+
"idempotency_key": "d67cfb41-4cc5-47d0-b2ca-c571e6420952"
|
141
|
+
},
|
142
|
+
"type": "charge.captured"
|
143
|
+
}
|
@@ -1,22 +1,69 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"livemode": false,
|
4
|
-
"id": "evt_00000000000000",
|
5
|
-
"type": "charge.dispute.created",
|
2
|
+
"id": "evt_000000000000000000000000",
|
6
3
|
"object": "event",
|
4
|
+
"api_version": "2020-08-27",
|
5
|
+
"created": 1648319940,
|
7
6
|
"data": {
|
8
7
|
"object": {
|
9
|
-
"
|
10
|
-
"amount": 1000,
|
11
|
-
"created": 1381080223,
|
12
|
-
"status": "needs_response",
|
13
|
-
"livemode": false,
|
14
|
-
"currency": "usd",
|
8
|
+
"id": "dp_000000000000000000000000",
|
15
9
|
"object": "dispute",
|
16
|
-
"
|
17
|
-
"balance_transaction":
|
18
|
-
"
|
19
|
-
|
10
|
+
"amount": 100,
|
11
|
+
"balance_transaction": null,
|
12
|
+
"balance_transactions": [
|
13
|
+
|
14
|
+
],
|
15
|
+
"charge": "ch_000000000000000000000000",
|
16
|
+
"created": 1648319940,
|
17
|
+
"currency": "usd",
|
18
|
+
"evidence": {
|
19
|
+
"access_activity_log": null,
|
20
|
+
"billing_address": null,
|
21
|
+
"cancellation_policy": null,
|
22
|
+
"cancellation_policy_disclosure": null,
|
23
|
+
"cancellation_rebuttal": null,
|
24
|
+
"customer_communication": null,
|
25
|
+
"customer_email_address": null,
|
26
|
+
"customer_name": null,
|
27
|
+
"customer_purchase_ip": null,
|
28
|
+
"customer_signature": null,
|
29
|
+
"duplicate_charge_documentation": null,
|
30
|
+
"duplicate_charge_explanation": null,
|
31
|
+
"duplicate_charge_id": null,
|
32
|
+
"product_description": null,
|
33
|
+
"receipt": null,
|
34
|
+
"refund_policy": null,
|
35
|
+
"refund_policy_disclosure": null,
|
36
|
+
"refund_refusal_explanation": null,
|
37
|
+
"service_date": null,
|
38
|
+
"service_documentation": null,
|
39
|
+
"shipping_address": null,
|
40
|
+
"shipping_carrier": null,
|
41
|
+
"shipping_date": null,
|
42
|
+
"shipping_documentation": null,
|
43
|
+
"shipping_tracking_number": null,
|
44
|
+
"uncategorized_file": null,
|
45
|
+
"uncategorized_text": null
|
46
|
+
},
|
47
|
+
"evidence_details": {
|
48
|
+
"due_by": 1649116799,
|
49
|
+
"has_evidence": false,
|
50
|
+
"past_due": false,
|
51
|
+
"submission_count": 0
|
52
|
+
},
|
53
|
+
"is_charge_refundable": true,
|
54
|
+
"livemode": false,
|
55
|
+
"metadata": {
|
56
|
+
},
|
57
|
+
"payment_intent": null,
|
58
|
+
"reason": "fraudulent",
|
59
|
+
"status": "warning_needs_response"
|
20
60
|
}
|
21
|
-
}
|
22
|
-
|
61
|
+
},
|
62
|
+
"livemode": false,
|
63
|
+
"pending_webhooks": 2,
|
64
|
+
"request": {
|
65
|
+
"id": "req_00000000000000",
|
66
|
+
"idempotency_key": "fa04076c-aa1f-40b8-9191-95465afc576e"
|
67
|
+
},
|
68
|
+
"type": "charge.dispute.created"
|
69
|
+
}
|
@@ -1,56 +1,113 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"livemode": false,
|
4
|
-
"id": "evt_00000000000000",
|
5
|
-
"type": "charge.failed",
|
2
|
+
"id": "evt_000000000000000000000000",
|
6
3
|
"object": "event",
|
4
|
+
"api_version": "2020-08-27",
|
5
|
+
"created": 1648320028,
|
7
6
|
"data": {
|
8
7
|
"object": {
|
9
|
-
"id": "
|
8
|
+
"id": "ch_000000000000000000000000",
|
10
9
|
"object": "charge",
|
11
|
-
"
|
10
|
+
"amount": 2000,
|
11
|
+
"amount_captured": 0,
|
12
|
+
"amount_refunded": 0,
|
13
|
+
"application": null,
|
14
|
+
"application_fee": null,
|
15
|
+
"application_fee_amount": null,
|
16
|
+
"balance_transaction": null,
|
17
|
+
"billing_details": {
|
18
|
+
"address": {
|
19
|
+
"city": null,
|
20
|
+
"country": null,
|
21
|
+
"line1": null,
|
22
|
+
"line2": null,
|
23
|
+
"postal_code": null,
|
24
|
+
"state": null
|
25
|
+
},
|
26
|
+
"email": null,
|
27
|
+
"name": null,
|
28
|
+
"phone": null
|
29
|
+
},
|
30
|
+
"calculated_statement_descriptor": "EXAMPLECOMPANY",
|
31
|
+
"captured": false,
|
32
|
+
"created": 1648320028,
|
33
|
+
"currency": "usd",
|
34
|
+
"customer": null,
|
35
|
+
"description": "(created by Stripe CLI)",
|
36
|
+
"destination": null,
|
37
|
+
"dispute": null,
|
38
|
+
"disputed": false,
|
39
|
+
"failure_code": "card_declined",
|
40
|
+
"failure_message": "Your card was declined.",
|
41
|
+
"fraud_details": {
|
42
|
+
},
|
43
|
+
"invoice": null,
|
12
44
|
"livemode": false,
|
45
|
+
"metadata": {
|
46
|
+
},
|
47
|
+
"on_behalf_of": null,
|
48
|
+
"order": null,
|
49
|
+
"outcome": {
|
50
|
+
"network_status": "declined_by_network",
|
51
|
+
"reason": "generic_decline",
|
52
|
+
"risk_level": "normal",
|
53
|
+
"risk_score": 1,
|
54
|
+
"seller_message": "The bank did not return any further details with this decline.",
|
55
|
+
"type": "issuer_declined"
|
56
|
+
},
|
13
57
|
"paid": false,
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
"
|
37
|
-
"address_line1_check": null,
|
38
|
-
"address_zip_check": null
|
58
|
+
"payment_intent": "pi_000000000000000000000000",
|
59
|
+
"payment_method": "pm_000000000000000000000000",
|
60
|
+
"payment_method_details": {
|
61
|
+
"card": {
|
62
|
+
"brand": "visa",
|
63
|
+
"checks": {
|
64
|
+
"address_line1_check": null,
|
65
|
+
"address_postal_code_check": null,
|
66
|
+
"cvc_check": null
|
67
|
+
},
|
68
|
+
"country": "US",
|
69
|
+
"exp_month": 3,
|
70
|
+
"exp_year": 2023,
|
71
|
+
"fingerprint": "kMzSwhaalD1uR96R",
|
72
|
+
"funding": "credit",
|
73
|
+
"installments": null,
|
74
|
+
"last4": "0002",
|
75
|
+
"mandate": null,
|
76
|
+
"network": "visa",
|
77
|
+
"three_d_secure": null,
|
78
|
+
"wallet": null
|
79
|
+
},
|
80
|
+
"type": "card"
|
39
81
|
},
|
40
|
-
"
|
82
|
+
"receipt_email": null,
|
83
|
+
"receipt_number": null,
|
84
|
+
"receipt_url": null,
|
85
|
+
"refunded": false,
|
41
86
|
"refunds": {
|
87
|
+
"object": "list",
|
88
|
+
"data": [
|
42
89
|
|
90
|
+
],
|
91
|
+
"has_more": false,
|
92
|
+
"total_count": 0,
|
93
|
+
"url": "/v1/charges/ch_000000000000000000000000/refunds"
|
43
94
|
},
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
}
|
95
|
+
"review": null,
|
96
|
+
"shipping": null,
|
97
|
+
"source": null,
|
98
|
+
"source_transfer": null,
|
99
|
+
"statement_descriptor": null,
|
100
|
+
"statement_descriptor_suffix": null,
|
101
|
+
"status": "failed",
|
102
|
+
"transfer_data": null,
|
103
|
+
"transfer_group": null
|
54
104
|
}
|
55
|
-
}
|
56
|
-
|
105
|
+
},
|
106
|
+
"livemode": false,
|
107
|
+
"pending_webhooks": 2,
|
108
|
+
"request": {
|
109
|
+
"id": "req_00000000000000",
|
110
|
+
"idempotency_key": "57ddc22f-1d42-446f-8f91-85cf0d32084a"
|
111
|
+
},
|
112
|
+
"type": "charge.failed"
|
113
|
+
}
|