class GoCardless::Resources::RedirectFlow

Redirect flows enable you to use GoCardless Pro’s secure payment pages to set up mandates with your customers.

The overall flow is:

  1. You

[create](developer.gocardless.com/pro/#create-a-redirect-flow) a redirect flow for your customer, and redirect them to the returned redirect url, e.g. ‘pay.gocardless.com/flow/RE123`.

  1. Your customer

supplies their name, email, address, and bank account details, and submits the form. This securely stores their details, and redirects them back to your ‘success_redirect_url` with `redirect_flow_id=RE123` in the querystring.

  1. You

[complete](developer.gocardless.com/pro/#complete-a-redirect-flow) the redirect flow, which creates a [customer](developer.gocardless.com/pro/#api-endpoints-customers), [customer bank account](developer.gocardless.com/pro/#api-endpoints-customer-bank-accounts), and [mandate](developer.gocardless.com/pro/#api-endpoints-mandates), and returns the ID of the mandate. You may wish to create a [subscription](developer.gocardless.com/pro/#api-endpoints-subscriptions) or [payment](developer.gocardless.com/pro/#api-endpoints-payments) at this point.

It is recommended that you link the redirect flow to your user object as soon as it is created, and attach the created resources to that user in the complete step.

Redirect flows expire 30 minutes after they are first created. You cannot [complete](developer.gocardless.com/pro/#complete-a-redirect-flow) an expired redirect flow.

[View an example integration](pay-sandbox.gocardless.com/AL000000AKFPFF) that uses redirect flows. Represents an instance of a redirect_flow resource returned from the API

Attributes

created_at[R]
description[R]
id[R]
redirect_url[R]
scheme[R]
session_token[R]
success_redirect_url[R]

Public Class Methods

new(object) click to toggle source

initialize a resource instance @param object [Hash] an object returned from the API

# File lib/gocardless-pro/resources/redirect_flow.rb, line 72
def initialize(object)
  @object = object

  @created_at = object['created_at']
  @description = object['description']
  @id = object['id']
  @links = object['links']
  @redirect_url = object['redirect_url']
  @scheme = object['scheme']
  @session_token = object['session_token']
  @success_redirect_url = object['success_redirect_url']
end

Public Instance Methods

to_h() click to toggle source

Provides the resource as a hash of all it’s readable attributes

# File lib/gocardless-pro/resources/redirect_flow.rb, line 99
def to_h
  @object
end