Edit this Page

Coding Custom Payment Form

Warning : This section requires software development expertise.

For various reasons, you may want to develop your own payment form. If you want to develop your payment form, you must create 2 pages:

  • Payment page: Customer's payment information is collected in this web page.
  • Callback page: After the collection is completed, the customer is redirected to this web page.

Payment Page

To develop your own payment form, you must have the following parameters in your form.

Offer and Company Information

Subscriber Parameters

  • subscriber.name: John
  • subscriber.surname: Doe
  • subscriber.email: johndoe@gmail.com
  • subscriber.phoneNumber: 5555555

Payment Parameters

  • paymentType: CC
  • paymentCard.cardHolderName: John Doe
  • paymentCard.cardNumber: 4355 0843 5508 4358
  • paymentCard.expireMonth: 12
  • paymentCard.expireYear: 2019
  • paymentCard.cvc: 000

You need to send these parameters using HTTP POST method to:

https://${sitename}.subscreasy.com/na/subscription/start/4ds

Assuming that the subdomain that you use for your company is acme, in this case, you should POST to the following address:

https://acme.subscreasy.com/na/subscription/start/4ds

Sample HTML Form

<form method = "post" action = "https://acme.subscreasy.com/na/subscription/start/4ds">
<input type = "hidden" name = "offer.id" value = "4737" /> <br />
<input type = "hidden" name = "companySiteName" value = "acme" /> <br />
<input type = "hidden" name = "callbackUrl" value = "https://acme.subscreasy.com/payment3ds/success" /> <br />
<input type = "hidden" name = "errorCallbackUrl" value = "https://acme.subscreasy.com/payment3ds/failure" /> <br />

    Subscriber Name: <input type = "text" name = "subscriber.name" value = "" /> <br />
    Subscriber Surname: <input type = "text" name = "subscriber.surname" value = "" /> <br />
    Email: <input type = "text" name = "subscriber.email" value = "" /> <br />
    Phone Number: <input type = "text" name = "subscriber.phoneNumber" value = "" /> <br />

    Cardholder Name: <login type = "text" name = "paymentCard.cardHolderName" value = "" /> <br />
    Card Number: <input type = "text" name = "paymentCard.cardNumber" value = "" /> <br />
    Expiry Month: <input type = "text" name = "paymentCard.expireMonth" value = "" /> <br />
    Expiry Year: <input type = "text" name = "paymentCard.expireYear" value = "" /> <br />
    Security Code: <input type = "text" name = "paymentCard.cvc" value = "" /> <br />
    <input type = "hidden" name = "paymentType" value = "CC" /> <br />

    <input type = "checkbox" name = "privacyPolicyUrl" value = "true" /> I accept privacy policy <br />

    <button type="submit">Pay Now</button>
</form>

Error Codes

Error codes are delivered in the form of HTTP headers. When there is an error, HTTP response code is returned as 400. The error details are provided in X-subscreasy-error-key and X-subscreasy-error headers.

subscription-http-response

To determine the error text in our web page, you need to check out X-subscreasy-error-key and X-subscreasy-error header contents. Below are the list of errors that is returned by Subscreasy which can occur during a subscription transaction:

  • error.required.subscriber.name
  • error.required.subscriber.surname
  • error.required.card.expiry
  • error.required.card.number
  • error.required.card.cvc
  • error.required.offer.id
  • error.notfound.offer
  • error.required.shipping.address
  • error.alreadysubscribed

Sample Curl Request

Success Callback Page

After the collection process is completed, the customer is redirected to this address. As in the following example, transaction results are returned to the callback page as query parameter:

http://browsymous.example.com:8080/payment3ds/success?paymentId=13368433&authCode=280997&subscriptionId=19&nextChargingDate=1626100355&subscriberSecureId=feee3cacf15248ada2ea2a32df7aec25&subscriberName=Aygun Ozdemir&subscriberSurname=Ozdemir&startDate=1626100295&endDate=1626100355&offerId=-124&offerName=MentalUp Demo Edition 1 Hour&price=10.00000000&

Callback sayfasına aşağıdaki parametreler dönülür:

  • paymentId
  • authCode
  • subscriptionId
  • nextChargingDate
  • subscriberSecureId
  • merchantSubscriberId
  • subscriberName
  • subscriberSurname
  • startDate
  • endDate
  • offerId
  • offerName
  • price

It is the merchant's discretion to keep these parameters for future use. You can always access payment information from the subscreasy dashboard or via API access.

Error Callback Page

If payment fails, the customer is redirected to this address. Error details are returned to error callback page as query parameter:

https://acme.subscreasy.com/payment3ds/failure?errorCode=10012&errorText=Geçersiz işlem

The following parameters are returned to the callback page:

  • errorCode
  • errorText