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,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class OAuthService < StripeService
|
5
|
+
def authorize_url(params = {}, opts = {})
|
6
|
+
path = if opts[:express]
|
7
|
+
"/express/oauth/authorize"
|
8
|
+
else
|
9
|
+
"/oauth/authorize"
|
10
|
+
end
|
11
|
+
|
12
|
+
params[:client_id] = client_id(params)
|
13
|
+
|
14
|
+
params[:response_type] = "code" if params.include?(:response_type)
|
15
|
+
|
16
|
+
query = Util.encode_parameters(params, :v1)
|
17
|
+
|
18
|
+
connect_api_base = @requestor.config.base_addresses[:connect]
|
19
|
+
raise ArgumentError, "connect_api_base cannot be empty" if connect_api_base.nil? || connect_api_base.empty?
|
20
|
+
|
21
|
+
"#{connect_api_base}#{path}?#{query}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def token(params = {}, opts = {})
|
25
|
+
opts = Util.normalize_opts(opts)
|
26
|
+
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
27
|
+
|
28
|
+
request(
|
29
|
+
method: :post,
|
30
|
+
path: "/oauth/token",
|
31
|
+
params: params,
|
32
|
+
opts: opts,
|
33
|
+
base_address: :connect
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
def deauthorize(params = {}, opts = {})
|
38
|
+
params[:client_id] = client_id(params)
|
39
|
+
|
40
|
+
request(
|
41
|
+
method: :post,
|
42
|
+
path: "/oauth/deauthorize",
|
43
|
+
params: params,
|
44
|
+
opts: opts,
|
45
|
+
base_address: :connect
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
private def client_id(params = {})
|
50
|
+
return params[:client_id] if params.include?(:client_id)
|
51
|
+
|
52
|
+
return @requestor.config.client_id if !@requestor.config.client_id.nil? && !@requestor.config.client_id.empty?
|
53
|
+
|
54
|
+
raise AuthenticationError, "No client_id provided. (HINT: set your client_id when configuring " \
|
55
|
+
"your StripeClient: \"Stripe::StripeClient.new(..., client_id: <CLIENT_ID>)\"). " \
|
56
|
+
"You can find your client_ids in your Stripe dashboard at " \
|
57
|
+
"https://dashboard.stripe.com/account/applications/settings, " \
|
58
|
+
"after registering your account as a platform. See " \
|
59
|
+
"https://stripe.com/docs/connect/standalone-accounts for details, " \
|
60
|
+
"or email support@stripe.com if you have any questions." \
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentIntentService < StripeService
|
6
|
+
# Manually reconcile the remaining amount for a customer_balance PaymentIntent.
|
7
|
+
def apply_customer_balance(intent, params = {}, opts = {})
|
8
|
+
request(
|
9
|
+
method: :post,
|
10
|
+
path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
|
11
|
+
params: params,
|
12
|
+
opts: opts,
|
13
|
+
base_address: :api
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# 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.
|
18
|
+
#
|
19
|
+
# 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.
|
20
|
+
#
|
21
|
+
# You can't cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire) instead.
|
22
|
+
def cancel(intent, params = {}, opts = {})
|
23
|
+
request(
|
24
|
+
method: :post,
|
25
|
+
path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
|
26
|
+
params: params,
|
27
|
+
opts: opts,
|
28
|
+
base_address: :api
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
|
33
|
+
#
|
34
|
+
# Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
|
35
|
+
#
|
36
|
+
# Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
|
37
|
+
def capture(intent, params = {}, opts = {})
|
38
|
+
request(
|
39
|
+
method: :post,
|
40
|
+
path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
|
41
|
+
params: params,
|
42
|
+
opts: opts,
|
43
|
+
base_address: :api
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Confirm that your customer intends to pay with current or provided
|
48
|
+
# payment method. Upon confirmation, the PaymentIntent will attempt to initiate
|
49
|
+
# a payment.
|
50
|
+
# If the selected payment method requires additional authentication steps, the
|
51
|
+
# PaymentIntent will transition to the requires_action status and
|
52
|
+
# suggest additional actions via next_action. If payment fails,
|
53
|
+
# the PaymentIntent transitions to the requires_payment_method status or the
|
54
|
+
# canceled status if the confirmation limit is reached. If
|
55
|
+
# payment succeeds, the PaymentIntent will transition to the succeeded
|
56
|
+
# status (or requires_capture, if capture_method is set to manual).
|
57
|
+
# If the confirmation_method is automatic, payment may be attempted
|
58
|
+
# using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
|
59
|
+
# and the PaymentIntent's [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
|
60
|
+
# After next_actions are handled by the client, no additional
|
61
|
+
# confirmation is required to complete the payment.
|
62
|
+
# If the confirmation_method is manual, all payment attempts must be
|
63
|
+
# initiated using a secret key.
|
64
|
+
# If any actions are required for the payment, the PaymentIntent will
|
65
|
+
# return to the requires_confirmation state
|
66
|
+
# after those actions are completed. Your server needs to then
|
67
|
+
# explicitly re-confirm the PaymentIntent to initiate the next payment
|
68
|
+
# attempt.
|
69
|
+
# There is a variable upper limit on how many times a PaymentIntent can be confirmed.
|
70
|
+
# After this limit is reached, any further calls to this endpoint will
|
71
|
+
# transition the PaymentIntent to the canceled state.
|
72
|
+
def confirm(intent, params = {}, opts = {})
|
73
|
+
request(
|
74
|
+
method: :post,
|
75
|
+
path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
|
76
|
+
params: params,
|
77
|
+
opts: opts,
|
78
|
+
base_address: :api
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Creates a PaymentIntent object.
|
83
|
+
#
|
84
|
+
# After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm)
|
85
|
+
# to continue the payment. Learn more about <a href="/docs/payments/payment-intents">the available payment flows
|
86
|
+
# with the Payment Intents API.
|
87
|
+
#
|
88
|
+
# When you use confirm=true during creation, it's equivalent to creating
|
89
|
+
# and confirming the PaymentIntent in the same call. You can use any parameters
|
90
|
+
# available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
|
91
|
+
# confirm=true.
|
92
|
+
def create(params = {}, opts = {})
|
93
|
+
request(
|
94
|
+
method: :post,
|
95
|
+
path: "/v1/payment_intents",
|
96
|
+
params: params,
|
97
|
+
opts: opts,
|
98
|
+
base_address: :api
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Perform an incremental authorization on an eligible
|
103
|
+
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
104
|
+
# PaymentIntent's status must be requires_capture and
|
105
|
+
# [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
|
106
|
+
# must be true.
|
107
|
+
#
|
108
|
+
# Incremental authorizations attempt to increase the authorized amount on
|
109
|
+
# your customer's card to the new, higher amount provided. Similar to the
|
110
|
+
# initial authorization, incremental authorizations can be declined. A
|
111
|
+
# single PaymentIntent can call this endpoint multiple times to further
|
112
|
+
# increase the authorized amount.
|
113
|
+
#
|
114
|
+
# If the incremental authorization succeeds, the PaymentIntent object
|
115
|
+
# returns with the updated
|
116
|
+
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
|
117
|
+
# If the incremental authorization fails, a
|
118
|
+
# [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
|
119
|
+
# fields on the PaymentIntent or Charge update. The PaymentIntent
|
120
|
+
# object remains capturable for the previously authorized amount.
|
121
|
+
#
|
122
|
+
# Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
|
123
|
+
# After it's captured, a PaymentIntent can no longer be incremented.
|
124
|
+
#
|
125
|
+
# Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
|
126
|
+
def increment_authorization(intent, params = {}, opts = {})
|
127
|
+
request(
|
128
|
+
method: :post,
|
129
|
+
path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
|
130
|
+
params: params,
|
131
|
+
opts: opts,
|
132
|
+
base_address: :api
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Returns a list of PaymentIntents.
|
137
|
+
def list(params = {}, opts = {})
|
138
|
+
request(
|
139
|
+
method: :get,
|
140
|
+
path: "/v1/payment_intents",
|
141
|
+
params: params,
|
142
|
+
opts: opts,
|
143
|
+
base_address: :api
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
# Retrieves the details of a PaymentIntent that has previously been created.
|
148
|
+
#
|
149
|
+
# You can retrieve a PaymentIntent client-side using a publishable key when the client_secret is in the query string.
|
150
|
+
#
|
151
|
+
# If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties. Refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details.
|
152
|
+
def retrieve(intent, params = {}, opts = {})
|
153
|
+
request(
|
154
|
+
method: :get,
|
155
|
+
path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }),
|
156
|
+
params: params,
|
157
|
+
opts: opts,
|
158
|
+
base_address: :api
|
159
|
+
)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Search for PaymentIntents you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
|
163
|
+
# Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
|
164
|
+
# conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
|
165
|
+
# to an hour behind during outages. Search functionality is not available to merchants in India.
|
166
|
+
def search(params = {}, opts = {})
|
167
|
+
request(
|
168
|
+
method: :get,
|
169
|
+
path: "/v1/payment_intents/search",
|
170
|
+
params: params,
|
171
|
+
opts: opts,
|
172
|
+
base_address: :api
|
173
|
+
)
|
174
|
+
end
|
175
|
+
|
176
|
+
# Updates properties on a PaymentIntent object without confirming.
|
177
|
+
#
|
178
|
+
# Depending on which properties you update, you might need to confirm the
|
179
|
+
# PaymentIntent again. For example, updating the payment_method
|
180
|
+
# always requires you to confirm the PaymentIntent again. If you prefer to
|
181
|
+
# update and confirm at the same time, we recommend updating properties through
|
182
|
+
# the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead.
|
183
|
+
def update(intent, params = {}, opts = {})
|
184
|
+
request(
|
185
|
+
method: :post,
|
186
|
+
path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }),
|
187
|
+
params: params,
|
188
|
+
opts: opts,
|
189
|
+
base_address: :api
|
190
|
+
)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Verifies microdeposits on a PaymentIntent object.
|
194
|
+
def verify_microdeposits(intent, params = {}, opts = {})
|
195
|
+
request(
|
196
|
+
method: :post,
|
197
|
+
path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
|
198
|
+
params: params,
|
199
|
+
opts: opts,
|
200
|
+
base_address: :api
|
201
|
+
)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentLinkLineItemService < StripeService
|
6
|
+
# 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.
|
7
|
+
def list(payment_link, params = {}, opts = {})
|
8
|
+
request(
|
9
|
+
method: :get,
|
10
|
+
path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
|
11
|
+
params: params,
|
12
|
+
opts: opts,
|
13
|
+
base_address: :api
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentLinkService < StripeService
|
6
|
+
attr_reader :line_items
|
7
|
+
|
8
|
+
def initialize(requestor)
|
9
|
+
super(requestor)
|
10
|
+
@line_items = Stripe::PaymentLinkLineItemService.new(@requestor)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Creates a payment link.
|
14
|
+
def create(params = {}, opts = {})
|
15
|
+
request(
|
16
|
+
method: :post,
|
17
|
+
path: "/v1/payment_links",
|
18
|
+
params: params,
|
19
|
+
opts: opts,
|
20
|
+
base_address: :api
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns a list of your payment links.
|
25
|
+
def list(params = {}, opts = {})
|
26
|
+
request(
|
27
|
+
method: :get,
|
28
|
+
path: "/v1/payment_links",
|
29
|
+
params: params,
|
30
|
+
opts: opts,
|
31
|
+
base_address: :api
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Retrieve a payment link.
|
36
|
+
def retrieve(payment_link, params = {}, opts = {})
|
37
|
+
request(
|
38
|
+
method: :get,
|
39
|
+
path: format("/v1/payment_links/%<payment_link>s", { payment_link: CGI.escape(payment_link) }),
|
40
|
+
params: params,
|
41
|
+
opts: opts,
|
42
|
+
base_address: :api
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Updates a payment link.
|
47
|
+
def update(payment_link, params = {}, opts = {})
|
48
|
+
request(
|
49
|
+
method: :post,
|
50
|
+
path: format("/v1/payment_links/%<payment_link>s", { payment_link: CGI.escape(payment_link) }),
|
51
|
+
params: params,
|
52
|
+
opts: opts,
|
53
|
+
base_address: :api
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentMethodConfigurationService < StripeService
|
6
|
+
# Creates a payment method configuration
|
7
|
+
def create(params = {}, opts = {})
|
8
|
+
request(
|
9
|
+
method: :post,
|
10
|
+
path: "/v1/payment_method_configurations",
|
11
|
+
params: params,
|
12
|
+
opts: opts,
|
13
|
+
base_address: :api
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# List payment method configurations
|
18
|
+
def list(params = {}, opts = {})
|
19
|
+
request(
|
20
|
+
method: :get,
|
21
|
+
path: "/v1/payment_method_configurations",
|
22
|
+
params: params,
|
23
|
+
opts: opts,
|
24
|
+
base_address: :api
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Retrieve payment method configuration
|
29
|
+
def retrieve(configuration, params = {}, opts = {})
|
30
|
+
request(
|
31
|
+
method: :get,
|
32
|
+
path: format("/v1/payment_method_configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
|
33
|
+
params: params,
|
34
|
+
opts: opts,
|
35
|
+
base_address: :api
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Update payment method configuration
|
40
|
+
def update(configuration, params = {}, opts = {})
|
41
|
+
request(
|
42
|
+
method: :post,
|
43
|
+
path: format("/v1/payment_method_configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
|
44
|
+
params: params,
|
45
|
+
opts: opts,
|
46
|
+
base_address: :api
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentMethodDomainService < StripeService
|
6
|
+
# Creates a payment method domain.
|
7
|
+
def create(params = {}, opts = {})
|
8
|
+
request(
|
9
|
+
method: :post,
|
10
|
+
path: "/v1/payment_method_domains",
|
11
|
+
params: params,
|
12
|
+
opts: opts,
|
13
|
+
base_address: :api
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Lists the details of existing payment method domains.
|
18
|
+
def list(params = {}, opts = {})
|
19
|
+
request(
|
20
|
+
method: :get,
|
21
|
+
path: "/v1/payment_method_domains",
|
22
|
+
params: params,
|
23
|
+
opts: opts,
|
24
|
+
base_address: :api
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Retrieves the details of an existing payment method domain.
|
29
|
+
def retrieve(payment_method_domain, params = {}, opts = {})
|
30
|
+
request(
|
31
|
+
method: :get,
|
32
|
+
path: format("/v1/payment_method_domains/%<payment_method_domain>s", { payment_method_domain: CGI.escape(payment_method_domain) }),
|
33
|
+
params: params,
|
34
|
+
opts: opts,
|
35
|
+
base_address: :api
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Updates an existing payment method domain.
|
40
|
+
def update(payment_method_domain, params = {}, opts = {})
|
41
|
+
request(
|
42
|
+
method: :post,
|
43
|
+
path: format("/v1/payment_method_domains/%<payment_method_domain>s", { payment_method_domain: CGI.escape(payment_method_domain) }),
|
44
|
+
params: params,
|
45
|
+
opts: opts,
|
46
|
+
base_address: :api
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
|
51
|
+
# The payment method doesn't appear in Elements for this domain until it is active.
|
52
|
+
#
|
53
|
+
# To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
|
54
|
+
#
|
55
|
+
# Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
|
56
|
+
def validate(payment_method_domain, params = {}, opts = {})
|
57
|
+
request(
|
58
|
+
method: :post,
|
59
|
+
path: format("/v1/payment_method_domains/%<payment_method_domain>s/validate", { payment_method_domain: CGI.escape(payment_method_domain) }),
|
60
|
+
params: params,
|
61
|
+
opts: opts,
|
62
|
+
base_address: :api
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PaymentMethodService < StripeService
|
6
|
+
# Attaches a PaymentMethod object to a Customer.
|
7
|
+
#
|
8
|
+
# To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents)
|
9
|
+
# or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
|
10
|
+
# These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
|
11
|
+
# endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for
|
12
|
+
# future use, which makes later declines and payment friction more likely.
|
13
|
+
# See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up
|
14
|
+
# future payments.
|
15
|
+
#
|
16
|
+
# To use this PaymentMethod as the default for invoice or subscription payments,
|
17
|
+
# set [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method),
|
18
|
+
# on the Customer to the PaymentMethod's ID.
|
19
|
+
def attach(payment_method, params = {}, opts = {})
|
20
|
+
request(
|
21
|
+
method: :post,
|
22
|
+
path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
|
23
|
+
params: params,
|
24
|
+
opts: opts,
|
25
|
+
base_address: :api
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# 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.
|
30
|
+
#
|
31
|
+
# 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.
|
32
|
+
def create(params = {}, opts = {})
|
33
|
+
request(
|
34
|
+
method: :post,
|
35
|
+
path: "/v1/payment_methods",
|
36
|
+
params: params,
|
37
|
+
opts: opts,
|
38
|
+
base_address: :api
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# 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.
|
43
|
+
def detach(payment_method, params = {}, opts = {})
|
44
|
+
request(
|
45
|
+
method: :post,
|
46
|
+
path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
|
47
|
+
params: params,
|
48
|
+
opts: opts,
|
49
|
+
base_address: :api
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# 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.
|
54
|
+
def list(params = {}, opts = {})
|
55
|
+
request(
|
56
|
+
method: :get,
|
57
|
+
path: "/v1/payment_methods",
|
58
|
+
params: params,
|
59
|
+
opts: opts,
|
60
|
+
base_address: :api
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use [Retrieve a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer)
|
65
|
+
def retrieve(payment_method, params = {}, opts = {})
|
66
|
+
request(
|
67
|
+
method: :get,
|
68
|
+
path: format("/v1/payment_methods/%<payment_method>s", { payment_method: CGI.escape(payment_method) }),
|
69
|
+
params: params,
|
70
|
+
opts: opts,
|
71
|
+
base_address: :api
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
# Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
|
76
|
+
def update(payment_method, params = {}, opts = {})
|
77
|
+
request(
|
78
|
+
method: :post,
|
79
|
+
path: format("/v1/payment_methods/%<payment_method>s", { payment_method: CGI.escape(payment_method) }),
|
80
|
+
params: params,
|
81
|
+
opts: opts,
|
82
|
+
base_address: :api
|
83
|
+
)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PayoutService < StripeService
|
6
|
+
# You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
|
7
|
+
def cancel(payout, params = {}, opts = {})
|
8
|
+
request(
|
9
|
+
method: :post,
|
10
|
+
path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
|
11
|
+
params: params,
|
12
|
+
opts: opts,
|
13
|
+
base_address: :api
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
# To send funds to your own bank account, create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. If it doesn't, you receive an “Insufficient Funds” error.
|
18
|
+
#
|
19
|
+
# If your API key is in test mode, money won't actually be sent, though every other action occurs as if you're in live mode.
|
20
|
+
#
|
21
|
+
# If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type.
|
22
|
+
def create(params = {}, opts = {})
|
23
|
+
request(method: :post, path: "/v1/payouts", params: params, opts: opts, base_address: :api)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.
|
27
|
+
def list(params = {}, opts = {})
|
28
|
+
request(method: :get, path: "/v1/payouts", params: params, opts: opts, base_address: :api)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Retrieves the details of an existing payout. Supply the unique payout ID from either a payout creation request or the payout list. Stripe returns the corresponding payout information.
|
32
|
+
def retrieve(payout, params = {}, opts = {})
|
33
|
+
request(
|
34
|
+
method: :get,
|
35
|
+
path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
|
36
|
+
params: params,
|
37
|
+
opts: opts,
|
38
|
+
base_address: :api
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
|
43
|
+
#
|
44
|
+
# By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
|
45
|
+
def reverse(payout, params = {}, opts = {})
|
46
|
+
request(
|
47
|
+
method: :post,
|
48
|
+
path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
|
49
|
+
params: params,
|
50
|
+
opts: opts,
|
51
|
+
base_address: :api
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Updates the specified payout by setting the values of the parameters you pass. We don't change parameters that you don't provide. This request only accepts the metadata as arguments.
|
56
|
+
def update(payout, params = {}, opts = {})
|
57
|
+
request(
|
58
|
+
method: :post,
|
59
|
+
path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
|
60
|
+
params: params,
|
61
|
+
opts: opts,
|
62
|
+
base_address: :api
|
63
|
+
)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class PlanService < StripeService
|
6
|
+
# You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
|
7
|
+
def create(params = {}, opts = {})
|
8
|
+
request(method: :post, path: "/v1/plans", params: params, opts: opts, base_address: :api)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
|
12
|
+
def delete(plan, params = {}, opts = {})
|
13
|
+
request(
|
14
|
+
method: :delete,
|
15
|
+
path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
|
16
|
+
params: params,
|
17
|
+
opts: opts,
|
18
|
+
base_address: :api
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Returns a list of your plans.
|
23
|
+
def list(params = {}, opts = {})
|
24
|
+
request(method: :get, path: "/v1/plans", params: params, opts: opts, base_address: :api)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Retrieves the plan with the given ID.
|
28
|
+
def retrieve(plan, params = {}, opts = {})
|
29
|
+
request(
|
30
|
+
method: :get,
|
31
|
+
path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
|
32
|
+
params: params,
|
33
|
+
opts: opts,
|
34
|
+
base_address: :api
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle.
|
39
|
+
def update(plan, params = {}, opts = {})
|
40
|
+
request(
|
41
|
+
method: :post,
|
42
|
+
path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
|
43
|
+
params: params,
|
44
|
+
opts: opts,
|
45
|
+
base_address: :api
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|