stripe 5.55.0 → 13.5.1
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 +4 -4
- data/CHANGELOG.md +567 -4
- data/Gemfile +12 -4
- data/Makefile +18 -3
- data/OPENAPI_VERSION +1 -0
- data/README.md +93 -21
- data/Rakefile +3 -6
- data/VERSION +1 -1
- data/examples/README.md +16 -0
- data/examples/example_template.rb +36 -0
- data/examples/meter_event_stream.rb +57 -0
- data/examples/thinevent_webhook_handler.rb +39 -0
- data/{bin → exe}/stripe-console +1 -1
- data/justfile +43 -0
- data/lib/data/ca-certificates.crt +1241 -1937
- data/lib/stripe/api_operations/create.rb +6 -2
- data/lib/stripe/api_operations/delete.rb +12 -7
- data/lib/stripe/api_operations/list.rb +6 -9
- data/lib/stripe/api_operations/nested_resource.rb +63 -35
- data/lib/stripe/api_operations/request.rb +29 -65
- data/lib/stripe/api_operations/save.rb +20 -10
- data/lib/stripe/api_operations/search.rb +11 -9
- data/lib/stripe/api_operations/singleton_save.rb +90 -0
- data/lib/stripe/api_requestor.rb +1131 -0
- data/lib/stripe/api_resource.rb +48 -18
- data/lib/stripe/api_resource_test_helpers.rb +9 -3
- data/lib/stripe/api_version.rb +8 -0
- data/lib/stripe/connection_manager.rb +5 -7
- data/lib/stripe/errors.rb +11 -13
- data/lib/stripe/event_types.rb +14 -0
- data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
- data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
- data/lib/stripe/instrumentation.rb +37 -15
- data/lib/stripe/list_object.rb +5 -3
- data/lib/stripe/multipart_encoder.rb +7 -7
- data/lib/stripe/oauth.rb +14 -21
- data/lib/stripe/object_types.rb +151 -103
- data/lib/stripe/request_options.rb +129 -0
- data/lib/stripe/resources/account.rb +129 -25
- data/lib/stripe/resources/account_link.rb +12 -0
- data/lib/stripe/resources/account_session.rb +25 -0
- data/lib/stripe/resources/alipay_account.rb +1 -1
- data/lib/stripe/resources/apple_pay_domain.rb +38 -0
- data/lib/stripe/resources/application_fee.rb +9 -2
- data/lib/stripe/resources/application_fee_refund.rb +9 -2
- data/lib/stripe/resources/apps/secret.rb +55 -0
- data/lib/stripe/resources/balance.rb +14 -0
- data/lib/stripe/resources/balance_transaction.rb +19 -0
- data/lib/stripe/resources/bank_account.rb +53 -4
- data/lib/stripe/resources/billing/alert.rb +87 -0
- data/lib/stripe/resources/billing/credit_balance_summary.rb +14 -0
- data/lib/stripe/resources/billing/credit_balance_transaction.rb +26 -0
- data/lib/stripe/resources/billing/credit_grant.rb +90 -0
- data/lib/stripe/resources/billing/meter.rb +85 -0
- data/lib/stripe/resources/billing/meter_event.rb +26 -0
- data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
- data/lib/stripe/resources/billing/meter_event_summary.rb +17 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +34 -0
- data/lib/stripe/resources/billing_portal/session.rb +27 -0
- data/lib/stripe/resources/capability.rb +7 -2
- data/lib/stripe/resources/card.rb +34 -3
- data/lib/stripe/resources/cash_balance.rb +4 -0
- data/lib/stripe/resources/charge.rb +52 -3
- data/lib/stripe/resources/checkout/session.rb +83 -5
- data/lib/stripe/resources/climate/order.rb +67 -0
- data/lib/stripe/resources/climate/product.rb +27 -0
- data/lib/stripe/resources/climate/supplier.rb +26 -0
- data/lib/stripe/resources/confirmation_token.rb +39 -0
- data/lib/stripe/resources/country_spec.rb +14 -0
- data/lib/stripe/resources/coupon.rb +48 -0
- data/lib/stripe/resources/credit_note.rb +67 -9
- data/lib/stripe/resources/credit_note_line_item.rb +4 -0
- data/lib/stripe/resources/customer.rb +172 -28
- data/lib/stripe/resources/customer_balance_transaction.rb +9 -1
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +15 -0
- data/lib/stripe/resources/customer_session.rb +29 -0
- data/lib/stripe/resources/discount.rb +7 -0
- data/lib/stripe/resources/dispute.rb +41 -3
- data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
- data/lib/stripe/resources/entitlements/feature.rb +49 -0
- data/lib/stripe/resources/ephemeral_key.rb +23 -0
- data/lib/stripe/resources/event.rb +38 -0
- data/lib/stripe/resources/exchange_rate.rb +34 -0
- data/lib/stripe/resources/file.rb +37 -15
- data/lib/stripe/resources/file_link.rb +26 -0
- data/lib/stripe/resources/financial_connections/account.rb +101 -6
- data/lib/stripe/resources/financial_connections/account_owner.rb +4 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +4 -0
- data/lib/stripe/resources/financial_connections/session.rb +14 -0
- data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
- data/lib/stripe/resources/forwarding/request.rb +52 -0
- data/lib/stripe/resources/funding_instructions.rb +8 -0
- data/lib/stripe/resources/identity/verification_report.rb +24 -0
- data/lib/stripe/resources/identity/verification_session.rb +117 -5
- data/lib/stripe/resources/invoice.rb +247 -20
- data/lib/stripe/resources/invoice_item.rb +54 -0
- data/lib/stripe/resources/invoice_line_item.rb +22 -1
- data/lib/stripe/resources/invoice_rendering_template.rb +65 -0
- data/lib/stripe/resources/issuing/authorization.rb +210 -5
- data/lib/stripe/resources/issuing/card.rb +128 -4
- data/lib/stripe/resources/issuing/cardholder.rb +36 -0
- data/lib/stripe/resources/issuing/dispute.rb +47 -2
- data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
- data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
- data/lib/stripe/resources/issuing/token.rb +32 -0
- data/lib/stripe/resources/issuing/transaction.rb +79 -0
- data/lib/stripe/resources/line_item.rb +4 -0
- data/lib/stripe/resources/login_link.rb +4 -0
- data/lib/stripe/resources/mandate.rb +4 -0
- data/lib/stripe/resources/payment_intent.rb +238 -15
- data/lib/stripe/resources/payment_link.rb +39 -2
- data/lib/stripe/resources/payment_method.rb +78 -5
- data/lib/stripe/resources/payment_method_configuration.rb +59 -0
- data/lib/stripe/resources/payment_method_domain.rb +79 -0
- data/lib/stripe/resources/payout.rb +63 -5
- data/lib/stripe/resources/person.rb +8 -1
- data/lib/stripe/resources/plan.rb +51 -0
- data/lib/stripe/resources/price.rb +30 -1
- data/lib/stripe/resources/product.rb +55 -1
- data/lib/stripe/resources/product_feature.rb +13 -0
- data/lib/stripe/resources/promotion_code.rb +25 -0
- data/lib/stripe/resources/quote.rb +97 -39
- data/lib/stripe/resources/radar/early_fraud_warning.rb +17 -0
- data/lib/stripe/resources/radar/value_list.rb +56 -0
- data/lib/stripe/resources/radar/value_list_item.rb +46 -0
- data/lib/stripe/resources/refund.rb +70 -5
- data/lib/stripe/resources/reporting/report_run.rb +31 -0
- data/lib/stripe/resources/reporting/report_type.rb +21 -1
- data/lib/stripe/resources/reversal.rb +17 -2
- data/lib/stripe/resources/review.rb +24 -3
- data/lib/stripe/resources/setup_attempt.rb +12 -0
- data/lib/stripe/resources/setup_intent.rb +113 -7
- data/lib/stripe/resources/shipping_rate.rb +25 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +17 -0
- data/lib/stripe/resources/source.rb +52 -10
- data/lib/stripe/resources/source_transaction.rb +7 -0
- data/lib/stripe/resources/subscription.rb +118 -5
- data/lib/stripe/resources/subscription_item.rb +54 -6
- data/lib/stripe/resources/subscription_schedule.rb +60 -5
- data/lib/stripe/resources/tax/calculation.rb +48 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +13 -0
- data/lib/stripe/resources/tax/registration.rb +54 -0
- data/lib/stripe/resources/tax/settings.rb +17 -0
- data/lib/stripe/resources/tax/transaction.rb +56 -0
- data/lib/stripe/resources/tax/transaction_line_item.rb +13 -0
- data/lib/stripe/resources/tax_code.rb +9 -0
- data/lib/stripe/resources/tax_id.rb +34 -12
- data/lib/stripe/resources/tax_rate.rb +26 -0
- data/lib/stripe/resources/terminal/configuration.rb +54 -0
- data/lib/stripe/resources/terminal/connection_token.rb +16 -0
- data/lib/stripe/resources/terminal/location.rb +57 -0
- data/lib/stripe/resources/terminal/reader.rb +138 -11
- data/lib/stripe/resources/test_helpers/test_clock.rb +58 -3
- data/lib/stripe/resources/token.rb +29 -0
- data/lib/stripe/resources/topup.rb +40 -3
- data/lib/stripe/resources/transfer.rb +29 -6
- data/lib/stripe/resources/treasury/credit_reversal.rb +37 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +37 -0
- data/lib/stripe/resources/treasury/financial_account.rb +109 -0
- data/lib/stripe/resources/treasury/financial_account_features.rb +15 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +130 -0
- data/lib/stripe/resources/treasury/outbound_payment.rb +152 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +152 -0
- data/lib/stripe/resources/treasury/received_credit.rb +47 -0
- data/lib/stripe/resources/treasury/received_debit.rb +47 -0
- data/lib/stripe/resources/treasury/transaction.rb +26 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +30 -0
- data/lib/stripe/resources/usage_record.rb +9 -0
- data/lib/stripe/resources/usage_record_summary.rb +4 -0
- data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
- data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
- data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
- data/lib/stripe/resources/v2/event.rb +13 -0
- data/lib/stripe/resources/v2/event_destination.rb +13 -0
- data/lib/stripe/resources/webhook_endpoint.rb +55 -0
- data/lib/stripe/resources.rb +51 -10
- data/lib/stripe/search_result_object.rb +5 -2
- data/lib/stripe/services/account_capability_service.rb +39 -0
- data/lib/stripe/services/account_external_account_service.rb +68 -0
- data/lib/stripe/services/account_link_service.rb +17 -0
- data/lib/stripe/services/account_login_link_service.rb +19 -0
- data/lib/stripe/services/account_person_service.rb +61 -0
- data/lib/stripe/services/account_service.rb +100 -0
- data/lib/stripe/services/account_session_service.rb +17 -0
- data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
- data/lib/stripe/services/application_fee_refund_service.rb +60 -0
- data/lib/stripe/services/application_fee_service.rb +35 -0
- data/lib/stripe/services/apps/secret_service.rb +52 -0
- data/lib/stripe/services/apps_service.rb +13 -0
- data/lib/stripe/services/balance_service.rb +12 -0
- data/lib/stripe/services/balance_transaction_service.rb +32 -0
- data/lib/stripe/services/billing/alert_service.rb +74 -0
- data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
- data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
- data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
- data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
- data/lib/stripe/services/billing/meter_event_service.rb +19 -0
- data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
- data/lib/stripe/services/billing/meter_service.rb +81 -0
- data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
- data/lib/stripe/services/billing_portal/session_service.rb +19 -0
- data/lib/stripe/services/billing_portal_service.rb +14 -0
- data/lib/stripe/services/billing_service.rb +20 -0
- data/lib/stripe/services/charge_service.rb +69 -0
- data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
- data/lib/stripe/services/checkout/session_service.rb +72 -0
- data/lib/stripe/services/checkout_service.rb +13 -0
- data/lib/stripe/services/climate/order_service.rb +68 -0
- data/lib/stripe/services/climate/product_service.rb +30 -0
- data/lib/stripe/services/climate/supplier_service.rb +30 -0
- data/lib/stripe/services/climate_service.rb +15 -0
- data/lib/stripe/services/confirmation_token_service.rb +17 -0
- data/lib/stripe/services/country_spec_service.rb +28 -0
- data/lib/stripe/services/coupon_service.rb +51 -0
- data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
- data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
- data/lib/stripe/services/credit_note_service.rb +93 -0
- data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
- data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
- data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
- data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
- data/lib/stripe/services/customer_payment_method_service.rb +28 -0
- data/lib/stripe/services/customer_payment_source_service.rb +76 -0
- data/lib/stripe/services/customer_service.rb +89 -0
- data/lib/stripe/services/customer_session_service.rb +17 -0
- data/lib/stripe/services/customer_tax_id_service.rb +50 -0
- data/lib/stripe/services/dispute_service.rb +48 -0
- data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
- data/lib/stripe/services/entitlements/feature_service.rb +52 -0
- data/lib/stripe/services/entitlements_service.rb +14 -0
- data/lib/stripe/services/ephemeral_key_service.rb +28 -0
- data/lib/stripe/services/event_service.rb +22 -0
- data/lib/stripe/services/exchange_rate_service.rb +28 -0
- data/lib/stripe/services/file_link_service.rb +38 -0
- data/lib/stripe/services/file_service.rb +35 -0
- data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
- data/lib/stripe/services/financial_connections/account_service.rb +81 -0
- data/lib/stripe/services/financial_connections/session_service.rb +30 -0
- data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
- data/lib/stripe/services/financial_connections_service.rb +15 -0
- data/lib/stripe/services/forwarding/request_service.rb +41 -0
- data/lib/stripe/services/forwarding_service.rb +13 -0
- data/lib/stripe/services/identity/verification_report_service.rb +30 -0
- data/lib/stripe/services/identity/verification_session_service.rb +106 -0
- data/lib/stripe/services/identity_service.rb +14 -0
- data/lib/stripe/services/invoice_item_service.rb +61 -0
- data/lib/stripe/services/invoice_line_item_service.rb +31 -0
- data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
- data/lib/stripe/services/invoice_service.rb +202 -0
- data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
- data/lib/stripe/services/issuing/authorization_service.rb +65 -0
- data/lib/stripe/services/issuing/card_service.rb +52 -0
- data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
- data/lib/stripe/services/issuing/dispute_service.rb +63 -0
- data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
- data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
- data/lib/stripe/services/issuing/token_service.rb +41 -0
- data/lib/stripe/services/issuing/transaction_service.rb +41 -0
- data/lib/stripe/services/issuing_service.rb +20 -0
- data/lib/stripe/services/mandate_service.rb +17 -0
- data/lib/stripe/services/oauth_service.rb +63 -0
- data/lib/stripe/services/payment_intent_service.rb +204 -0
- data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
- data/lib/stripe/services/payment_link_service.rb +57 -0
- data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
- data/lib/stripe/services/payment_method_domain_service.rb +66 -0
- data/lib/stripe/services/payment_method_service.rb +86 -0
- data/lib/stripe/services/payout_service.rb +66 -0
- data/lib/stripe/services/plan_service.rb +49 -0
- data/lib/stripe/services/price_service.rb +52 -0
- data/lib/stripe/services/product_feature_service.rb +50 -0
- data/lib/stripe/services/product_service.rb +70 -0
- data/lib/stripe/services/promotion_code_service.rb +50 -0
- data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
- data/lib/stripe/services/quote_line_item_service.rb +17 -0
- data/lib/stripe/services/quote_service.rb +92 -0
- data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
- data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
- data/lib/stripe/services/radar/value_list_service.rb +63 -0
- data/lib/stripe/services/radar_service.rb +15 -0
- data/lib/stripe/services/refund_service.rb +63 -0
- data/lib/stripe/services/reporting/report_run_service.rb +41 -0
- data/lib/stripe/services/reporting/report_type_service.rb +30 -0
- data/lib/stripe/services/reporting_service.rb +14 -0
- data/lib/stripe/services/review_service.rb +33 -0
- data/lib/stripe/services/setup_attempt_service.rb +17 -0
- data/lib/stripe/services/setup_intent_service.rb +105 -0
- data/lib/stripe/services/shipping_rate_service.rb +50 -0
- data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
- data/lib/stripe/services/sigma_service.rb +13 -0
- data/lib/stripe/services/source_service.rb +64 -0
- data/lib/stripe/services/source_transaction_service.rb +17 -0
- data/lib/stripe/services/subscription_item_service.rb +69 -0
- data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
- data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
- data/lib/stripe/services/subscription_schedule_service.rb +72 -0
- data/lib/stripe/services/subscription_service.rb +127 -0
- data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
- data/lib/stripe/services/tax/calculation_service.rb +37 -0
- data/lib/stripe/services/tax/registration_service.rb +54 -0
- data/lib/stripe/services/tax/settings_service.rb +30 -0
- data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
- data/lib/stripe/services/tax/transaction_service.rb +48 -0
- data/lib/stripe/services/tax_code_service.rb +22 -0
- data/lib/stripe/services/tax_id_service.rb +38 -0
- data/lib/stripe/services/tax_rate_service.rb +38 -0
- data/lib/stripe/services/tax_service.rb +16 -0
- data/lib/stripe/services/terminal/configuration_service.rb +63 -0
- data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
- data/lib/stripe/services/terminal/location_service.rb +64 -0
- data/lib/stripe/services/terminal/reader_service.rb +118 -0
- data/lib/stripe/services/terminal_service.rb +16 -0
- data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
- data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
- data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +87 -0
- data/lib/stripe/services/test_helpers/issuing/card_service.rb +65 -0
- data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
- data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
- data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
- data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
- data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
- data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
- data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
- data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
- data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
- data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
- data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
- data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
- data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
- data/lib/stripe/services/test_helpers_service.rb +19 -0
- data/lib/stripe/services/token_service.rb +23 -0
- data/lib/stripe/services/topup_service.rb +49 -0
- data/lib/stripe/services/transfer_reversal_service.rb +56 -0
- data/lib/stripe/services/transfer_service.rb +47 -0
- data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
- data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
- data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
- data/lib/stripe/services/treasury/financial_account_service.rb +70 -0
- data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
- data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
- data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
- data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
- data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
- data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
- data/lib/stripe/services/treasury/transaction_service.rb +30 -0
- data/lib/stripe/services/treasury_service.rb +22 -0
- data/lib/stripe/services/v1_services.rb +89 -0
- data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
- data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
- data/lib/stripe/services/v2/billing_service.rb +18 -0
- data/lib/stripe/services/v2/core/event_destination_service.rb +98 -0
- data/lib/stripe/services/v2/core/event_service.rb +32 -0
- data/lib/stripe/services/v2/core_service.rb +16 -0
- data/lib/stripe/services/v2_services.rb +14 -0
- data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
- data/lib/stripe/services.rb +182 -0
- data/lib/stripe/singleton_api_resource.rb +3 -3
- data/lib/stripe/stripe_client.rb +55 -1028
- data/lib/stripe/stripe_configuration.rb +63 -42
- data/lib/stripe/stripe_object.rb +60 -38
- data/lib/stripe/stripe_response.rb +1 -3
- data/lib/stripe/stripe_service.rb +32 -0
- data/lib/stripe/thin_event.rb +37 -0
- data/lib/stripe/util.rb +109 -45
- data/lib/stripe/v2_list_object.rb +84 -0
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +3 -2
- data/lib/stripe.rb +39 -0
- data/stripe.gemspec +7 -4
- metadata +252 -13
- data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
- data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
- data/lib/stripe/resources/issuing/card_details.rb +0 -10
- data/lib/stripe/resources/order.rb +0 -33
- data/lib/stripe/resources/order_return.rb +0 -10
- data/lib/stripe/resources/recipient.rb +0 -14
- data/lib/stripe/resources/sku.rb +0 -13
- data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -0,0 +1,32 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Issuing
|
6
|
+
# An issuing token object is created when an issued card is added to a digital wallet. As a [card issuer](https://stripe.com/docs/issuing), you can [view and manage these tokens](https://stripe.com/docs/issuing/controls/token-management) through Stripe.
|
7
|
+
class Token < APIResource
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
include Stripe::APIOperations::Save
|
10
|
+
|
11
|
+
OBJECT_NAME = "issuing.token"
|
12
|
+
def self.object_name
|
13
|
+
"issuing.token"
|
14
|
+
end
|
15
|
+
|
16
|
+
# Lists all Issuing Token objects for a given card.
|
17
|
+
def self.list(params = {}, opts = {})
|
18
|
+
request_stripe_object(method: :get, path: "/v1/issuing/tokens", params: params, opts: opts)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Attempts to update the specified Issuing Token object to the status specified.
|
22
|
+
def self.update(token, params = {}, opts = {})
|
23
|
+
request_stripe_object(
|
24
|
+
method: :post,
|
25
|
+
path: format("/v1/issuing/tokens/%<token>s", { token: CGI.escape(token) }),
|
26
|
+
params: params,
|
27
|
+
opts: opts
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -3,11 +3,90 @@
|
|
3
3
|
|
4
4
|
module Stripe
|
5
5
|
module Issuing
|
6
|
+
# Any use of an [issued card](https://stripe.com/docs/issuing) that results in funds entering or leaving
|
7
|
+
# your Stripe account, such as a completed purchase or refund, is represented by an Issuing
|
8
|
+
# `Transaction` object.
|
9
|
+
#
|
10
|
+
# Related guide: [Issued card transactions](https://stripe.com/docs/issuing/purchases/transactions)
|
6
11
|
class Transaction < APIResource
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
9
14
|
|
10
15
|
OBJECT_NAME = "issuing.transaction"
|
16
|
+
def self.object_name
|
17
|
+
"issuing.transaction"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns a list of Issuing Transaction objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
21
|
+
def self.list(params = {}, opts = {})
|
22
|
+
request_stripe_object(
|
23
|
+
method: :get,
|
24
|
+
path: "/v1/issuing/transactions",
|
25
|
+
params: params,
|
26
|
+
opts: opts
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Updates the specified Issuing Transaction object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
31
|
+
def self.update(transaction, params = {}, opts = {})
|
32
|
+
request_stripe_object(
|
33
|
+
method: :post,
|
34
|
+
path: format("/v1/issuing/transactions/%<transaction>s", { transaction: CGI.escape(transaction) }),
|
35
|
+
params: params,
|
36
|
+
opts: opts
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_helpers
|
41
|
+
TestHelpers.new(self)
|
42
|
+
end
|
43
|
+
|
44
|
+
class TestHelpers < APIResourceTestHelpers
|
45
|
+
RESOURCE_CLASS = Transaction
|
46
|
+
def self.resource_class
|
47
|
+
"Transaction"
|
48
|
+
end
|
49
|
+
|
50
|
+
# Allows the user to capture an arbitrary amount, also known as a forced capture.
|
51
|
+
def self.create_force_capture(params = {}, opts = {})
|
52
|
+
request_stripe_object(
|
53
|
+
method: :post,
|
54
|
+
path: "/v1/test_helpers/issuing/transactions/create_force_capture",
|
55
|
+
params: params,
|
56
|
+
opts: opts
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Allows the user to refund an arbitrary amount, also known as a unlinked refund.
|
61
|
+
def self.create_unlinked_refund(params = {}, opts = {})
|
62
|
+
request_stripe_object(
|
63
|
+
method: :post,
|
64
|
+
path: "/v1/test_helpers/issuing/transactions/create_unlinked_refund",
|
65
|
+
params: params,
|
66
|
+
opts: opts
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Refund a test-mode Transaction.
|
71
|
+
def self.refund(transaction, params = {}, opts = {})
|
72
|
+
request_stripe_object(
|
73
|
+
method: :post,
|
74
|
+
path: format("/v1/test_helpers/issuing/transactions/%<transaction>s/refund", { transaction: CGI.escape(transaction) }),
|
75
|
+
params: params,
|
76
|
+
opts: opts
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Refund a test-mode Transaction.
|
81
|
+
def refund(params = {}, opts = {})
|
82
|
+
@resource.request_stripe_object(
|
83
|
+
method: :post,
|
84
|
+
path: format("/v1/test_helpers/issuing/transactions/%<transaction>s/refund", { transaction: CGI.escape(@resource["id"]) }),
|
85
|
+
params: params,
|
86
|
+
opts: opts
|
87
|
+
)
|
88
|
+
end
|
89
|
+
end
|
11
90
|
end
|
12
91
|
end
|
13
92
|
end
|
@@ -2,8 +2,12 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# Login Links are single-use URLs for a connected account to access the Express Dashboard. The connected account's [account.controller.stripe_dashboard.type](https://stripe.com/api/accounts/object#account_object-controller-stripe_dashboard-type) must be `express` to have access to the Express Dashboard.
|
5
6
|
class LoginLink < APIResource
|
6
7
|
OBJECT_NAME = "login_link"
|
8
|
+
def self.object_name
|
9
|
+
"login_link"
|
10
|
+
end
|
7
11
|
|
8
12
|
def self.retrieve(_id, _opts = nil)
|
9
13
|
raise NotImplementedError,
|
@@ -2,7 +2,11 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A Mandate is a record of the permission that your customer gives you to debit their payment method.
|
5
6
|
class Mandate < APIResource
|
6
7
|
OBJECT_NAME = "mandate"
|
8
|
+
def self.object_name
|
9
|
+
"mandate"
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
@@ -2,6 +2,17 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A PaymentIntent guides you through the process of collecting a payment from your customer.
|
6
|
+
# We recommend that you create exactly one PaymentIntent for each order or
|
7
|
+
# customer session in your system. You can reference the PaymentIntent later to
|
8
|
+
# see the history of payment attempts for a particular session.
|
9
|
+
#
|
10
|
+
# A PaymentIntent transitions through
|
11
|
+
# [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses)
|
12
|
+
# throughout its lifetime as it interfaces with Stripe.js to perform
|
13
|
+
# authentication flows and ultimately creates at most one successful charge.
|
14
|
+
#
|
15
|
+
# Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents)
|
5
16
|
class PaymentIntent < APIResource
|
6
17
|
extend Stripe::APIOperations::Create
|
7
18
|
extend Stripe::APIOperations::List
|
@@ -9,74 +20,286 @@ module Stripe
|
|
9
20
|
include Stripe::APIOperations::Save
|
10
21
|
|
11
22
|
OBJECT_NAME = "payment_intent"
|
23
|
+
def self.object_name
|
24
|
+
"payment_intent"
|
25
|
+
end
|
12
26
|
|
13
|
-
|
14
|
-
custom_method :cancel, http_verb: :post
|
15
|
-
custom_method :capture, http_verb: :post
|
16
|
-
custom_method :confirm, http_verb: :post
|
17
|
-
custom_method :increment_authorization, http_verb: :post
|
18
|
-
custom_method :verify_microdeposits, http_verb: :post
|
19
|
-
|
27
|
+
# Manually reconcile the remaining amount for a customer_balance PaymentIntent.
|
20
28
|
def apply_customer_balance(params = {}, opts = {})
|
21
29
|
request_stripe_object(
|
22
30
|
method: :post,
|
23
|
-
path:
|
31
|
+
path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(self["id"]) }),
|
32
|
+
params: params,
|
33
|
+
opts: opts
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Manually reconcile the remaining amount for a customer_balance PaymentIntent.
|
38
|
+
def self.apply_customer_balance(intent, params = {}, opts = {})
|
39
|
+
request_stripe_object(
|
40
|
+
method: :post,
|
41
|
+
path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
|
24
42
|
params: params,
|
25
43
|
opts: opts
|
26
44
|
)
|
27
45
|
end
|
28
46
|
|
47
|
+
# You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
|
48
|
+
#
|
49
|
+
# After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
|
50
|
+
#
|
51
|
+
# You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
|
29
52
|
def cancel(params = {}, opts = {})
|
30
53
|
request_stripe_object(
|
31
54
|
method: :post,
|
32
|
-
path:
|
55
|
+
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
|
56
|
+
params: params,
|
57
|
+
opts: opts
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing.
|
62
|
+
#
|
63
|
+
# After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
|
64
|
+
#
|
65
|
+
# You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
|
66
|
+
def self.cancel(intent, params = {}, opts = {})
|
67
|
+
request_stripe_object(
|
68
|
+
method: :post,
|
69
|
+
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
|
33
70
|
params: params,
|
34
71
|
opts: opts
|
35
72
|
)
|
36
73
|
end
|
37
74
|
|
75
|
+
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
|
76
|
+
#
|
77
|
+
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
|
78
|
+
#
|
79
|
+
# Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
|
38
80
|
def capture(params = {}, opts = {})
|
39
81
|
request_stripe_object(
|
40
82
|
method: :post,
|
41
|
-
path:
|
83
|
+
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
|
42
84
|
params: params,
|
43
85
|
opts: opts
|
44
86
|
)
|
45
87
|
end
|
46
88
|
|
89
|
+
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
|
90
|
+
#
|
91
|
+
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
|
92
|
+
#
|
93
|
+
# Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
|
94
|
+
def self.capture(intent, params = {}, opts = {})
|
95
|
+
request_stripe_object(
|
96
|
+
method: :post,
|
97
|
+
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
|
98
|
+
params: params,
|
99
|
+
opts: opts
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Confirm that your customer intends to pay with current or provided
|
104
|
+
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
|
105
|
+
# a payment.
|
106
|
+
# If the selected payment method requires additional authentication steps, the
|
107
|
+
# PaymentIntent will transition to the requires_action status and
|
108
|
+
# suggest additional actions via next_action. If payment fails,
|
109
|
+
# the PaymentIntent transitions to the requires_payment_method status or the
|
110
|
+
# canceled status if the confirmation limit is reached. If
|
111
|
+
# payment succeeds, the PaymentIntent will transition to the succeeded
|
112
|
+
# status (or requires_capture, if capture_method is set to manual).
|
113
|
+
# If the confirmation_method is automatic, payment may be attempted
|
114
|
+
# using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
|
115
|
+
# and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
|
116
|
+
# After next_actions are handled by the client, no additional
|
117
|
+
# confirmation is required to complete the payment.
|
118
|
+
# If the confirmation_method is manual, all payment attempts must be
|
119
|
+
# initiated using a secret key.
|
120
|
+
# If any actions are required for the payment, the PaymentIntent will
|
121
|
+
# return to the requires_confirmation state
|
122
|
+
# after those actions are completed. Your server needs to then
|
123
|
+
# explicitly re-confirm the PaymentIntent to initiate the next payment
|
124
|
+
# attempt.
|
125
|
+
# There is a variable upper limit on how many times a PaymentIntent can be confirmed.
|
126
|
+
# After this limit is reached, any further calls to this endpoint will
|
127
|
+
# transition the PaymentIntent to the canceled state.
|
47
128
|
def confirm(params = {}, opts = {})
|
48
129
|
request_stripe_object(
|
49
130
|
method: :post,
|
50
|
-
path:
|
131
|
+
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
|
51
132
|
params: params,
|
52
133
|
opts: opts
|
53
134
|
)
|
54
135
|
end
|
55
136
|
|
137
|
+
# Confirm that your customer intends to pay with current or provided
|
138
|
+
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
|
139
|
+
# a payment.
|
140
|
+
# If the selected payment method requires additional authentication steps, the
|
141
|
+
# PaymentIntent will transition to the requires_action status and
|
142
|
+
# suggest additional actions via next_action. If payment fails,
|
143
|
+
# the PaymentIntent transitions to the requires_payment_method status or the
|
144
|
+
# canceled status if the confirmation limit is reached. If
|
145
|
+
# payment succeeds, the PaymentIntent will transition to the succeeded
|
146
|
+
# status (or requires_capture, if capture_method is set to manual).
|
147
|
+
# If the confirmation_method is automatic, payment may be attempted
|
148
|
+
# using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
|
149
|
+
# and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
|
150
|
+
# After next_actions are handled by the client, no additional
|
151
|
+
# confirmation is required to complete the payment.
|
152
|
+
# If the confirmation_method is manual, all payment attempts must be
|
153
|
+
# initiated using a secret key.
|
154
|
+
# If any actions are required for the payment, the PaymentIntent will
|
155
|
+
# return to the requires_confirmation state
|
156
|
+
# after those actions are completed. Your server needs to then
|
157
|
+
# explicitly re-confirm the PaymentIntent to initiate the next payment
|
158
|
+
# attempt.
|
159
|
+
# There is a variable upper limit on how many times a PaymentIntent can be confirmed.
|
160
|
+
# After this limit is reached, any further calls to this endpoint will
|
161
|
+
# transition the PaymentIntent to the canceled state.
|
162
|
+
def self.confirm(intent, params = {}, opts = {})
|
163
|
+
request_stripe_object(
|
164
|
+
method: :post,
|
165
|
+
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
|
166
|
+
params: params,
|
167
|
+
opts: opts
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Creates a PaymentIntent object.
|
172
|
+
#
|
173
|
+
# After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
|
174
|
+
# to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
|
175
|
+
# with the Payment Intents API.
|
176
|
+
#
|
177
|
+
# When you use confirm=true during creation, it's equivalent to creating
|
178
|
+
# and confirming the PaymentIntent in the same call. You can use any parameters
|
179
|
+
# available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
|
180
|
+
# confirm=true.
|
181
|
+
def self.create(params = {}, opts = {})
|
182
|
+
request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
|
183
|
+
end
|
184
|
+
|
185
|
+
# Perform an incremental authorization on an eligible
|
186
|
+
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
187
|
+
# PaymentIntent's status must be requires_capture and
|
188
|
+
# [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
|
189
|
+
# must be true.
|
190
|
+
#
|
191
|
+
# Incremental authorizations attempt to increase the authorized amount on
|
192
|
+
# your customer's card to the new, higher amount provided. Similar to the
|
193
|
+
# initial authorization, incremental authorizations can be declined. A
|
194
|
+
# single PaymentIntent can call this endpoint multiple times to further
|
195
|
+
# increase the authorized amount.
|
196
|
+
#
|
197
|
+
# If the incremental authorization succeeds, the PaymentIntent object
|
198
|
+
# returns with the updated
|
199
|
+
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
|
200
|
+
# If the incremental authorization fails, a
|
201
|
+
# [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
|
202
|
+
# fields on the PaymentIntent or Charge update. The PaymentIntent
|
203
|
+
# object remains capturable for the previously authorized amount.
|
204
|
+
#
|
205
|
+
# Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
|
206
|
+
# After it's captured, a PaymentIntent can no longer be incremented.
|
207
|
+
#
|
208
|
+
# Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
|
56
209
|
def increment_authorization(params = {}, opts = {})
|
57
210
|
request_stripe_object(
|
58
211
|
method: :post,
|
59
|
-
path:
|
212
|
+
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
|
60
213
|
params: params,
|
61
214
|
opts: opts
|
62
215
|
)
|
63
216
|
end
|
64
217
|
|
65
|
-
|
218
|
+
# Perform an incremental authorization on an eligible
|
219
|
+
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
220
|
+
# PaymentIntent's status must be requires_capture and
|
221
|
+
# [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
|
222
|
+
# must be true.
|
223
|
+
#
|
224
|
+
# Incremental authorizations attempt to increase the authorized amount on
|
225
|
+
# your customer's card to the new, higher amount provided. Similar to the
|
226
|
+
# initial authorization, incremental authorizations can be declined. A
|
227
|
+
# single PaymentIntent can call this endpoint multiple times to further
|
228
|
+
# increase the authorized amount.
|
229
|
+
#
|
230
|
+
# If the incremental authorization succeeds, the PaymentIntent object
|
231
|
+
# returns with the updated
|
232
|
+
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
|
233
|
+
# If the incremental authorization fails, a
|
234
|
+
# [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
|
235
|
+
# fields on the PaymentIntent or Charge update. The PaymentIntent
|
236
|
+
# object remains capturable for the previously authorized amount.
|
237
|
+
#
|
238
|
+
# Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
|
239
|
+
# After it's captured, a PaymentIntent can no longer be incremented.
|
240
|
+
#
|
241
|
+
# Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
|
242
|
+
def self.increment_authorization(intent, params = {}, opts = {})
|
66
243
|
request_stripe_object(
|
67
244
|
method: :post,
|
68
|
-
path:
|
245
|
+
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
|
69
246
|
params: params,
|
70
247
|
opts: opts
|
71
248
|
)
|
72
249
|
end
|
73
250
|
|
251
|
+
# Returns a list of PaymentIntents.
|
252
|
+
def self.list(params = {}, opts = {})
|
253
|
+
request_stripe_object(method: :get, path: "/v1/payment_intents", params: params, opts: opts)
|
254
|
+
end
|
255
|
+
|
74
256
|
def self.search(params = {}, opts = {})
|
75
|
-
|
257
|
+
request_stripe_object(
|
258
|
+
method: :get,
|
259
|
+
path: "/v1/payment_intents/search",
|
260
|
+
params: params,
|
261
|
+
opts: opts
|
262
|
+
)
|
76
263
|
end
|
77
264
|
|
78
265
|
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
79
266
|
search(params, opts).auto_paging_each(&blk)
|
80
267
|
end
|
268
|
+
|
269
|
+
# Updates properties on a PaymentIntent object without confirming.
|
270
|
+
#
|
271
|
+
# Depending on which properties you update, you might need to confirm the
|
272
|
+
# PaymentIntent again. For example, updating the payment_method
|
273
|
+
# always requires you to confirm the PaymentIntent again. If you prefer to
|
274
|
+
# update and confirm at the same time, we recommend updating properties through
|
275
|
+
# the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead.
|
276
|
+
def self.update(intent, params = {}, opts = {})
|
277
|
+
request_stripe_object(
|
278
|
+
method: :post,
|
279
|
+
path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }),
|
280
|
+
params: params,
|
281
|
+
opts: opts
|
282
|
+
)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Verifies microdeposits on a PaymentIntent object.
|
286
|
+
def verify_microdeposits(params = {}, opts = {})
|
287
|
+
request_stripe_object(
|
288
|
+
method: :post,
|
289
|
+
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
|
290
|
+
params: params,
|
291
|
+
opts: opts
|
292
|
+
)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Verifies microdeposits on a PaymentIntent object.
|
296
|
+
def self.verify_microdeposits(intent, params = {}, opts = {})
|
297
|
+
request_stripe_object(
|
298
|
+
method: :post,
|
299
|
+
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
|
300
|
+
params: params,
|
301
|
+
opts: opts
|
302
|
+
)
|
303
|
+
end
|
81
304
|
end
|
82
305
|
end
|
@@ -2,19 +2,56 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# A payment link is a shareable URL that will take your customers to a hosted payment page. A payment link can be shared and used multiple times.
|
6
|
+
#
|
7
|
+
# When a customer opens a payment link it will open a new [checkout session](https://stripe.com/docs/api/checkout/sessions) to render the payment page. You can use [checkout session events](https://stripe.com/docs/api/events/types#event_types-checkout.session.completed) to track payments through payment links.
|
8
|
+
#
|
9
|
+
# Related guide: [Payment Links API](https://stripe.com/docs/payment-links)
|
5
10
|
class PaymentLink < APIResource
|
6
11
|
extend Stripe::APIOperations::Create
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
9
14
|
|
10
15
|
OBJECT_NAME = "payment_link"
|
16
|
+
def self.object_name
|
17
|
+
"payment_link"
|
18
|
+
end
|
11
19
|
|
12
|
-
|
20
|
+
# Creates a payment link.
|
21
|
+
def self.create(params = {}, opts = {})
|
22
|
+
request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts)
|
23
|
+
end
|
13
24
|
|
25
|
+
# Returns a list of your payment links.
|
26
|
+
def self.list(params = {}, opts = {})
|
27
|
+
request_stripe_object(method: :get, path: "/v1/payment_links", params: params, opts: opts)
|
28
|
+
end
|
29
|
+
|
30
|
+
# When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
14
31
|
def list_line_items(params = {}, opts = {})
|
15
32
|
request_stripe_object(
|
16
33
|
method: :get,
|
17
|
-
path:
|
34
|
+
path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }),
|
35
|
+
params: params,
|
36
|
+
opts: opts
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
# When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
41
|
+
def self.list_line_items(payment_link, params = {}, opts = {})
|
42
|
+
request_stripe_object(
|
43
|
+
method: :get,
|
44
|
+
path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
|
45
|
+
params: params,
|
46
|
+
opts: opts
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Updates a payment link.
|
51
|
+
def self.update(payment_link, params = {}, opts = {})
|
52
|
+
request_stripe_object(
|
53
|
+
method: :post,
|
54
|
+
path: format("/v1/payment_links/%<payment_link>s", { payment_link: CGI.escape(payment_link) }),
|
18
55
|
params: params,
|
19
56
|
opts: opts
|
20
57
|
)
|
@@ -2,29 +2,102 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
module Stripe
|
5
|
+
# PaymentMethod objects represent your customer's payment instruments.
|
6
|
+
# You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to
|
7
|
+
# Customer objects to store instrument details for future payments.
|
8
|
+
#
|
9
|
+
# Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).
|
5
10
|
class PaymentMethod < APIResource
|
6
11
|
extend Stripe::APIOperations::Create
|
7
12
|
extend Stripe::APIOperations::List
|
8
13
|
include Stripe::APIOperations::Save
|
9
14
|
|
10
15
|
OBJECT_NAME = "payment_method"
|
16
|
+
def self.object_name
|
17
|
+
"payment_method"
|
18
|
+
end
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
20
|
+
# Attaches a PaymentMethod object to a Customer.
|
21
|
+
#
|
22
|
+
# To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
|
23
|
+
# or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
|
24
|
+
# These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
|
25
|
+
# endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
|
26
|
+
# future use, which makes later declines and payment friction more likely.
|
27
|
+
# See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
|
28
|
+
# future payments.
|
29
|
+
#
|
30
|
+
# To use this PaymentMethod as the default for invoice or subscription payments,
|
31
|
+
# set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
|
32
|
+
# on the Customer to the PaymentMethod's ID.
|
15
33
|
def attach(params = {}, opts = {})
|
16
34
|
request_stripe_object(
|
17
35
|
method: :post,
|
18
|
-
path:
|
36
|
+
path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(self["id"]) }),
|
37
|
+
params: params,
|
38
|
+
opts: opts
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attaches a PaymentMethod object to a Customer.
|
43
|
+
#
|
44
|
+
# To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
|
45
|
+
# or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
|
46
|
+
# These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
|
47
|
+
# endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
|
48
|
+
# future use, which makes later declines and payment friction more likely.
|
49
|
+
# See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
|
50
|
+
# future payments.
|
51
|
+
#
|
52
|
+
# To use this PaymentMethod as the default for invoice or subscription payments,
|
53
|
+
# set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
|
54
|
+
# on the Customer to the PaymentMethod's ID.
|
55
|
+
def self.attach(payment_method, params = {}, opts = {})
|
56
|
+
request_stripe_object(
|
57
|
+
method: :post,
|
58
|
+
path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
|
19
59
|
params: params,
|
20
60
|
opts: opts
|
21
61
|
)
|
22
62
|
end
|
23
63
|
|
64
|
+
# Creates a PaymentMethod object. Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
|
65
|
+
#
|
66
|
+
# Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent](https://stripe.com/docs/payments/accept-a-payment) API to collect payment method details ahead of a future payment.
|
67
|
+
def self.create(params = {}, opts = {})
|
68
|
+
request_stripe_object(method: :post, path: "/v1/payment_methods", params: params, opts: opts)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
|
24
72
|
def detach(params = {}, opts = {})
|
25
73
|
request_stripe_object(
|
26
74
|
method: :post,
|
27
|
-
path:
|
75
|
+
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
|
76
|
+
params: params,
|
77
|
+
opts: opts
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
|
82
|
+
def self.detach(payment_method, params = {}, opts = {})
|
83
|
+
request_stripe_object(
|
84
|
+
method: :post,
|
85
|
+
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
|
86
|
+
params: params,
|
87
|
+
opts: opts
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead.
|
92
|
+
def self.list(params = {}, opts = {})
|
93
|
+
request_stripe_object(method: :get, path: "/v1/payment_methods", params: params, opts: opts)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
|
97
|
+
def self.update(payment_method, params = {}, opts = {})
|
98
|
+
request_stripe_object(
|
99
|
+
method: :post,
|
100
|
+
path: format("/v1/payment_methods/%<payment_method>s", { payment_method: CGI.escape(payment_method) }),
|
28
101
|
params: params,
|
29
102
|
opts: opts
|
30
103
|
)
|