The TransparentRedirect module provides methods to build the tr_data param that must be submitted when using the transparent redirect API. For more information about transparent redirect, see (TODO).
You must provide a redirect_url that the gateway will redirect the user to when the action is complete.
tr_data = Braintree::TransparentRedirect.create_customer_data(
:redirect_url => "http://example.com/redirect_back_to_merchant_site
)
In addition to the redirect_url, any data that needs to be protected from user tampering should be included in the tr_data. For example, to prevent the user from tampering with the transaction amount, include the amount in the tr_data.
tr_data = Braintree::TransparentRedirect.transaction_data(
:redirect_url => "http://example.com/complete_transaction",
:transaction => {:amount => "100.00"}
)
Returns the tr_data string for updating a credit card. The payment_method_token of the credit card to update is required.
tr_data = Braintree::TransparentRedirect.update_credit_card_data(
:redirect_url => "http://example.com/redirect_here",
:payment_method_token => "token123"
)
Returns the tr_data string for updating a customer. The customer_id of the customer to update is required.
tr_data = Braintree::TransparentRedirect.update_customer_data(
:redirect_url => "http://example.com/redirect_here",
:customer_id => "customer123"
)