User.newsale

From SafeCreativeWiki

Jump to: navigation, search

Creates a new sale for a professional or corporate account.

The component returns a URL that the user must visit to complete payment.

A discount or gift code can be provided to apply to the sale. If this results in a zero-priced sale, the professional or corporate account will be automatically assigned to the user and no further process is needed.

You must be a Safe Creative partner to use this component.

Contents

Info

  • Component name: user.newsale
  • Signature: Requires signature using the authorization key's private key
  • Timestamp: Requires ztime parameter
  • API trust level: Partner

Parameters

  • authkey*: The user's authorization key
  • ztime*: Z-Timestamp
  • service*: Service to buy
    • PROFESSIONAL: Professional account
    • CORPORATE: Corporate account
  • promotioncode: Discount or gift code to apply to the sale
  • returnUrl: Return URL for payment page if payment is successful
  • cancelUrl: Return URL for payment page if payment is not completed
    • If return URLs are provided, both URLs must be included.

* Required parameter

Returns

  • sale
    • code Sale code
    • status Sale status
      • PAYMENT_PENDING: Sale is pending payment, a payment link is returned
      • PROCESSED: Sale is complete. This may happen if a gift code has been applied to the sale.
    • paymentlink If the sale is pending payment, this is the URL to redirect the user for payment. The link is customized with the provided return URLs

Example

REQUEST:

https://api.safecreative.org/v2/
?authkey=6i716m0pecao2morajk4b6xt9
&component=user.newsale
&service=PROFESSIONAL
&returnurl=http%3A%2F%2Fexample.com%2Fsale-return
&cancelurl=http%3A%2F%2Fexample.com%2Fsale-cancel
&ztime=1470825332701
&signature=81dac42a47e5987595cd4f57843bbe54986152e4

RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<sale>
  <code>PS1608100003311</code>
  <status>PAYMENT_PENDING</status>
  <paymentlink>https://account.safecreative.org/sale/PS1608100003311?r=http%3A%2F%2Fexample.com%2Fsale-return&amp;c=http%3A%2F%2Fexample.com%2Fsale-cancel</paymentlink>
</sale>

REQUEST:

https://api.safecreative.org/v2/
?authkey=6i716m0pecao2morajk4b6xt9
&component=user.newsale
&service=PROFESSIONAL
&promotioncode=SOME_GIFT_CODE
&ztime=1470824468855
&signature=061eae0fb02f2fd29d51d72f784e80667511a847

RESPONSE:

<?xml version="1.0" encoding="UTF-8"?>
<sale>
  <code>PS1608100003281</code>
  <status>PROCESSED</status>
</sale>
Personal tools
Safe Stamper API