Skip to content

Commit

Permalink
Add success and failure callback URLs to Simplex API form
Browse files Browse the repository at this point in the history
  • Loading branch information
sfncook committed Mar 18, 2020
1 parent 4509d1f commit 64a71d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,16 @@ export async function sellDetails (sellId) {
}

export const SimplexForm = props => {
const baseUrl = 'https://developer.edge.app/content/conversiontracker.html'
const successUrl = `${baseUrl}?currency=${encodeURI(props.quote.currency)}&digital_amount=${encodeURI(props.quote.fiat_total_amount_amount)}&order_id=${encodeURI(props.quote.payment_id)}`
const failureUrl = `${baseUrl}?dont_track=true`
return (
<form id="payment_form" action={edgeSimplexBuyUrl} method="POST" target="_self">
<input type="hidden" name="version" value={props.quote.version} />
<input type="hidden" name="partner" value={props.quote.partner} />
<input type="hidden" name="payment_flow_type" value={props.quote.payment_flow_type} />
<input type="hidden" name="return_url" value={props.quote.return_url} />
<input type="hidden" name="return_url_success" value={successUrl} />
<input type="hidden" name="return_url_fail" value={failureUrl} />
<input type="hidden" name="quote_id" value={props.quote.quote_id} />
<input type="hidden" name="payment_id" value={props.quote.payment_id} />
<input type="hidden" name="user_id" value={props.quote.user_id} />
Expand Down
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const edgeUrl = SANDBOX ? 'https://edge-sandbox.test-simplexcc.com' : 'ht

export const simplexUrl = SANDBOX ? 'https://sandbox.test-simplexcc.com/payments/new' : 'https://checkout.simplexcc.com/payments/new'

export const edgeLegacyBuyUrl = /* SANDBOX ? 'https://simplex-sandbox-api.edgesecure.co' : */'https://simplex-api.edgesecure.co'
export const edgeSimplexBuyUrl = /* SANDBOX ? 'https://sandbox.test-simplexcc.com/payments/new' : */'https://checkout.simplexcc.com/payments/new'
export const edgeLegacyBuyUrl = SANDBOX ? 'https://simplex-sandbox-api.edgesecure.co' : 'https://simplex-api.edgesecure.co'
export const edgeSimplexBuyUrl = SANDBOX ? 'https://sandbox.test-simplexcc.com/payments/new' : 'https://checkout.simplexcc.com/payments/new'

0 comments on commit 64a71d6

Please sign in to comment.