Sha256: 8438f265ced245b3fa0651a21b70c4d4f18b7b52a2504bdedcaaf7af5d2665db

Contents?: true

Size: 1.84 KB

Versions: 49

Compression:

Stored size: 1.84 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  # To top up your Stripe balance, you create a top-up object. You can retrieve
  # individual top-ups, as well as list all top-ups. Top-ups are identified by a
  # unique, random ID.
  #
  # Related guide: [Topping up your platform account](https://stripe.com/docs/connect/top-ups)
  class Topup < APIResource
    extend Stripe::APIOperations::Create
    extend Stripe::APIOperations::List
    include Stripe::APIOperations::Save

    OBJECT_NAME = "topup"
    def self.object_name
      "topup"
    end

    # Cancels a top-up. Only pending top-ups can be canceled.
    def cancel(params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(self["id"]) }),
        params: params,
        opts: opts
      )
    end

    # Cancels a top-up. Only pending top-ups can be canceled.
    def self.cancel(topup, params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }),
        params: params,
        opts: opts
      )
    end

    # Top up the balance of an account
    def self.create(params = {}, opts = {})
      request_stripe_object(method: :post, path: "/v1/topups", params: params, opts: opts)
    end

    # Returns a list of top-ups.
    def self.list(filters = {}, opts = {})
      request_stripe_object(method: :get, path: "/v1/topups", params: filters, opts: opts)
    end

    # Updates the metadata of a top-up. Other top-up details are not editable by design.
    def self.update(id, params = {}, opts = {})
      request_stripe_object(
        method: :post,
        path: format("/v1/topups/%<id>s", { id: CGI.escape(id) }),
        params: params,
        opts: opts
      )
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
stripe-13.3.0.pre.beta.1 lib/stripe/resources/topup.rb
stripe-13.2.0 lib/stripe/resources/topup.rb
stripe-13.1.2 lib/stripe/resources/topup.rb
stripe-13.2.0.pre.beta.3 lib/stripe/resources/topup.rb
stripe-13.2.0.pre.beta.2 lib/stripe/resources/topup.rb
stripe-13.1.1 lib/stripe/resources/topup.rb
stripe-13.2.0.pre.beta.1 lib/stripe/resources/topup.rb
stripe-13.1.0 lib/stripe/resources/topup.rb
stripe-13.0.2 lib/stripe/resources/topup.rb
stripe-13.1.0.pre.beta.3 lib/stripe/resources/topup.rb
stripe-13.0.1 lib/stripe/resources/topup.rb
stripe-13.1.0.pre.beta.2 lib/stripe/resources/topup.rb
stripe-13.0.0 lib/stripe/resources/topup.rb
stripe-12.7.0.pre.beta.2 lib/stripe/resources/topup.rb
stripe-12.7.0.pre.beta.1 lib/stripe/resources/topup.rb
stripe-12.6.0 lib/stripe/resources/topup.rb
stripe-12.6.0.pre.beta.1 lib/stripe/resources/topup.rb
stripe-12.5.0 lib/stripe/resources/topup.rb
stripe-12.5.0.pre.beta.2 lib/stripe/resources/topup.rb
stripe-12.5.0.pre.beta.1 lib/stripe/resources/topup.rb