Class: Stripe::PaymentLink
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::PaymentLink
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/payment_link.rb
Overview
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.
When a customer opens a payment link it will open a new [checkout session](docs.stripe.com/api/checkout/sessions) to render the payment page. You can use [checkout session events](docs.stripe.com/api/events/types#event_types-checkout.session.completed) to track payments through payment links.
Related guide: [Payment Links API](docs.stripe.com/payment-links)
Defined Under Namespace
Classes: AfterCompletion, AutomaticTax, ConsentCollection, CustomField, CustomText, InvoiceCreation, ManagedPayments, NameCollection, OptionalItem, PaymentIntentData, PhoneNumberCollection, Restrictions, ShippingAddressCollection, ShippingOption, SubscriptionData, TaxIdCollection, TransferData
Constant Summary collapse
- OBJECT_NAME =
"payment_link"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Whether the payment link’s ‘url` is active.
-
#after_completion ⇒ Object
readonly
Attribute for field after_completion.
-
#allow_promotion_codes ⇒ Object
readonly
Whether user redeemable promotion codes are enabled.
-
#application ⇒ Object
readonly
The ID of the Connect application that created the Payment Link.
-
#application_fee_amount ⇒ Object
readonly
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.
-
#application_fee_percent ⇒ Object
readonly
This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account.
-
#automatic_tax ⇒ Object
readonly
Attribute for field automatic_tax.
-
#billing_address_collection ⇒ Object
readonly
Configuration for collecting the customer’s billing address.
-
#consent_collection ⇒ Object
readonly
When set, provides configuration to gather active consent from customers.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#custom_fields ⇒ Object
readonly
Collect additional information from your customer using custom fields.
-
#custom_text ⇒ Object
readonly
Attribute for field custom_text.
-
#customer_creation ⇒ Object
readonly
Configuration for Customer creation during checkout.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#inactive_message ⇒ Object
readonly
The custom message to be displayed to a customer when a payment link is no longer active.
-
#invoice_creation ⇒ Object
readonly
Configuration for creating invoice for payment mode payment links.
-
#line_items ⇒ Object
readonly
The line items representing what is being sold.
-
#livemode ⇒ Object
readonly
If the object exists in live mode, the value is ‘true`.
-
#managed_payments ⇒ Object
readonly
Settings for Managed Payments for this Payment Link and resulting [CheckoutSessions](/api/checkout/sessions/object), [PaymentIntents](/api/payment_intents/object), [Invoices](/api/invoices/object), and [Subscriptions](/api/subscriptions/object).
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object.
-
#name_collection ⇒ Object
readonly
Attribute for field name_collection.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#on_behalf_of ⇒ Object
readonly
The account on behalf of which to charge.
-
#optional_items ⇒ Object
readonly
The optional items presented to the customer at checkout.
-
#payment_intent_data ⇒ Object
readonly
Indicates the parameters to be passed to PaymentIntent creation during checkout.
-
#payment_method_collection ⇒ Object
readonly
Configuration for collecting a payment method during checkout.
-
#payment_method_types ⇒ Object
readonly
The list of payment method types that customers can use.
-
#phone_number_collection ⇒ Object
readonly
Attribute for field phone_number_collection.
-
#restrictions ⇒ Object
readonly
Settings that restrict the usage of a payment link.
-
#shipping_address_collection ⇒ Object
readonly
Configuration for collecting the customer’s shipping address.
-
#shipping_options ⇒ Object
readonly
The shipping rate options applied to the session.
-
#submit_type ⇒ Object
readonly
Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
-
#subscription_data ⇒ Object
readonly
When creating a subscription, the specified configuration data will be used.
-
#tax_id_collection ⇒ Object
readonly
Attribute for field tax_id_collection.
-
#transfer_data ⇒ Object
readonly
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
-
#url ⇒ Object
readonly
The public URL that can be shared with customers.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a payment link.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your payment links.
-
.list_line_items(payment_link, params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items.
- .object_name ⇒ Object
-
.update(payment_link, params = {}, opts = {}) ⇒ Object
Updates a payment link.
Instance Method Summary collapse
-
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#active ⇒ Object (readonly)
Whether the payment link’s ‘url` is active. If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated.
671 672 673 |
# File 'lib/stripe/resources/payment_link.rb', line 671 def active @active end |
#after_completion ⇒ Object (readonly)
Attribute for field after_completion
673 674 675 |
# File 'lib/stripe/resources/payment_link.rb', line 673 def after_completion @after_completion end |
#allow_promotion_codes ⇒ Object (readonly)
Whether user redeemable promotion codes are enabled.
675 676 677 |
# File 'lib/stripe/resources/payment_link.rb', line 675 def allow_promotion_codes @allow_promotion_codes end |
#application ⇒ Object (readonly)
The ID of the Connect application that created the Payment Link.
677 678 679 |
# File 'lib/stripe/resources/payment_link.rb', line 677 def application @application end |
#application_fee_amount ⇒ Object (readonly)
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.
679 680 681 |
# File 'lib/stripe/resources/payment_link.rb', line 679 def application_fee_amount @application_fee_amount end |
#application_fee_percent ⇒ Object (readonly)
This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account.
681 682 683 |
# File 'lib/stripe/resources/payment_link.rb', line 681 def application_fee_percent @application_fee_percent end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
683 684 685 |
# File 'lib/stripe/resources/payment_link.rb', line 683 def automatic_tax @automatic_tax end |
#billing_address_collection ⇒ Object (readonly)
Configuration for collecting the customer’s billing address. Defaults to ‘auto`.
685 686 687 |
# File 'lib/stripe/resources/payment_link.rb', line 685 def billing_address_collection @billing_address_collection end |
#consent_collection ⇒ Object (readonly)
When set, provides configuration to gather active consent from customers.
687 688 689 |
# File 'lib/stripe/resources/payment_link.rb', line 687 def @consent_collection end |
#currency ⇒ Object (readonly)
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).
689 690 691 |
# File 'lib/stripe/resources/payment_link.rb', line 689 def currency @currency end |
#custom_fields ⇒ Object (readonly)
Collect additional information from your customer using custom fields. Up to 3 fields are supported. You can’t set this parameter if ‘ui_mode` is `custom`.
691 692 693 |
# File 'lib/stripe/resources/payment_link.rb', line 691 def custom_fields @custom_fields end |
#custom_text ⇒ Object (readonly)
Attribute for field custom_text
693 694 695 |
# File 'lib/stripe/resources/payment_link.rb', line 693 def custom_text @custom_text end |
#customer_creation ⇒ Object (readonly)
Configuration for Customer creation during checkout.
695 696 697 |
# File 'lib/stripe/resources/payment_link.rb', line 695 def customer_creation @customer_creation end |
#id ⇒ Object (readonly)
Unique identifier for the object.
697 698 699 |
# File 'lib/stripe/resources/payment_link.rb', line 697 def id @id end |
#inactive_message ⇒ Object (readonly)
The custom message to be displayed to a customer when a payment link is no longer active.
699 700 701 |
# File 'lib/stripe/resources/payment_link.rb', line 699 def @inactive_message end |
#invoice_creation ⇒ Object (readonly)
Configuration for creating invoice for payment mode payment links.
701 702 703 |
# File 'lib/stripe/resources/payment_link.rb', line 701 def invoice_creation @invoice_creation end |
#line_items ⇒ Object (readonly)
The line items representing what is being sold.
703 704 705 |
# File 'lib/stripe/resources/payment_link.rb', line 703 def line_items @line_items end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is ‘true`. If the object exists in test mode, the value is `false`.
705 706 707 |
# File 'lib/stripe/resources/payment_link.rb', line 705 def livemode @livemode end |
#managed_payments ⇒ Object (readonly)
Settings for Managed Payments for this Payment Link and resulting [CheckoutSessions](/api/checkout/sessions/object), [PaymentIntents](/api/payment_intents/object), [Invoices](/api/invoices/object), and [Subscriptions](/api/subscriptions/object).
707 708 709 |
# File 'lib/stripe/resources/payment_link.rb', line 707 def managed_payments @managed_payments end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
709 710 711 |
# File 'lib/stripe/resources/payment_link.rb', line 709 def @metadata end |
#name_collection ⇒ Object (readonly)
Attribute for field name_collection
711 712 713 |
# File 'lib/stripe/resources/payment_link.rb', line 711 def name_collection @name_collection end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
713 714 715 |
# File 'lib/stripe/resources/payment_link.rb', line 713 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account on behalf of which to charge. See the [Connect documentation](support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details.
715 716 717 |
# File 'lib/stripe/resources/payment_link.rb', line 715 def on_behalf_of @on_behalf_of end |
#optional_items ⇒ Object (readonly)
The optional items presented to the customer at checkout.
717 718 719 |
# File 'lib/stripe/resources/payment_link.rb', line 717 def optional_items @optional_items end |
#payment_intent_data ⇒ Object (readonly)
Indicates the parameters to be passed to PaymentIntent creation during checkout.
719 720 721 |
# File 'lib/stripe/resources/payment_link.rb', line 719 def payment_intent_data @payment_intent_data end |
#payment_method_collection ⇒ Object (readonly)
Configuration for collecting a payment method during checkout. Defaults to ‘always`.
721 722 723 |
# File 'lib/stripe/resources/payment_link.rb', line 721 def payment_method_collection @payment_method_collection end |
#payment_method_types ⇒ Object (readonly)
The list of payment method types that customers can use. When ‘null`, Stripe will dynamically show relevant payment methods you’ve enabled in your [payment method settings](dashboard.stripe.com/settings/payment_methods).
723 724 725 |
# File 'lib/stripe/resources/payment_link.rb', line 723 def payment_method_types @payment_method_types end |
#phone_number_collection ⇒ Object (readonly)
Attribute for field phone_number_collection
725 726 727 |
# File 'lib/stripe/resources/payment_link.rb', line 725 def phone_number_collection @phone_number_collection end |
#restrictions ⇒ Object (readonly)
Settings that restrict the usage of a payment link.
727 728 729 |
# File 'lib/stripe/resources/payment_link.rb', line 727 def restrictions @restrictions end |
#shipping_address_collection ⇒ Object (readonly)
Configuration for collecting the customer’s shipping address.
729 730 731 |
# File 'lib/stripe/resources/payment_link.rb', line 729 def shipping_address_collection @shipping_address_collection end |
#shipping_options ⇒ Object (readonly)
The shipping rate options applied to the session.
731 732 733 |
# File 'lib/stripe/resources/payment_link.rb', line 731 def @shipping_options end |
#submit_type ⇒ Object (readonly)
Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
733 734 735 |
# File 'lib/stripe/resources/payment_link.rb', line 733 def submit_type @submit_type end |
#subscription_data ⇒ Object (readonly)
When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use ‘subscription_data`.
735 736 737 |
# File 'lib/stripe/resources/payment_link.rb', line 735 def subscription_data @subscription_data end |
#tax_id_collection ⇒ Object (readonly)
Attribute for field tax_id_collection
737 738 739 |
# File 'lib/stripe/resources/payment_link.rb', line 737 def tax_id_collection @tax_id_collection end |
#transfer_data ⇒ Object (readonly)
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
739 740 741 |
# File 'lib/stripe/resources/payment_link.rb', line 739 def transfer_data @transfer_data end |
#url ⇒ Object (readonly)
The public URL that can be shared with customers.
741 742 743 |
# File 'lib/stripe/resources/payment_link.rb', line 741 def url @url end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a payment link.
744 745 746 |
# File 'lib/stripe/resources/payment_link.rb', line 744 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts) end |
.field_remappings ⇒ Object
805 806 807 |
# File 'lib/stripe/resources/payment_link.rb', line 805 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
# File 'lib/stripe/resources/payment_link.rb', line 783 def self.inner_class_types @inner_class_types = { after_completion: AfterCompletion, automatic_tax: AutomaticTax, consent_collection: ConsentCollection, custom_fields: CustomField, custom_text: CustomText, invoice_creation: InvoiceCreation, managed_payments: ManagedPayments, name_collection: NameCollection, optional_items: OptionalItem, payment_intent_data: PaymentIntentData, phone_number_collection: PhoneNumberCollection, restrictions: Restrictions, shipping_address_collection: ShippingAddressCollection, shipping_options: ShippingOption, subscription_data: SubscriptionData, tax_id_collection: TaxIdCollection, transfer_data: TransferData, } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your payment links.
749 750 751 |
# File 'lib/stripe/resources/payment_link.rb', line 749 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/payment_links", params: params, opts: opts) end |
.list_line_items(payment_link, params = {}, opts = {}) ⇒ Object
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.
764 765 766 767 768 769 770 771 |
# File 'lib/stripe/resources/payment_link.rb', line 764 def self.list_line_items(payment_link, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }), params: params, opts: opts ) end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/payment_link.rb', line 16 def self.object_name "payment_link" end |
.update(payment_link, params = {}, opts = {}) ⇒ Object
Updates a payment link.
774 775 776 777 778 779 780 781 |
# File 'lib/stripe/resources/payment_link.rb', line 774 def self.update(payment_link, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_links/%<payment_link>s", { payment_link: CGI.escape(payment_link) }), params: params, opts: opts ) end |
Instance Method Details
#list_line_items(params = {}, opts = {}) ⇒ Object
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.
754 755 756 757 758 759 760 761 |
# File 'lib/stripe/resources/payment_link.rb', line 754 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }), params: params, opts: opts ) end |