Click or drag to resize
Infosoft Logo

Credit Card Agreements

Using and managing credit card agreements

This section contains the following subsections:

Once a subscription has been created with a credit card agreement, it still needs to managed or utilised for additional purchases. Users forget which card they used when subscribing, cards are closed (or expired) and needs to be replaced. In order to provide these services, the API supports some management and information retrieval options.

Tip  Tip

The agreement interactions is split into 3 seperate services. For ease of use these services have been aggregated into a common service OnlinePaymentAgreementService, by default this service is hosted at Payment/OnlinePaymentAgreement.svc

Create an agreement without payment

When ordering a subscription with a credit card payment, an agreement is automatically created, but in some cases we want to create agreements without associating an actual purchase. For instance when the credit card has expired but the subscription should still be paid for by credit card. The process is very much like the process of ordering a subscription, the difference being that you need to associated the cutomer with the agreement.

Step-by-step

  1. Call StartPayment, using PaymentFlow to AgreementFlow

    Example request with agreement flow
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08">
      <soapenv:Header/>
      <soapenv:Body>                         
        <ns:StartPaymentRequest>
           <ns:PaymentSetupCode>IS</ns:PaymentSetupCode>
           <ns:Price>0</ns:Price>
           <ns:CurrencyCode>NOK</ns:CurrencyCode>
           <ns:TaxPercent>0</ns:TaxPercent>
           <ns:ProductDescription>A payment creation</ns:ProductDescription>
           <ns:ExternalOrderId>42</ns:ExternalOrderId>
           <ns:ReturnUrl>http://google.com</ns:ReturnUrl>
           <ns:CancelUrl>http://bing.com</ns:CancelUrl>
           <ns:ClientIpAddress>127.0.0.1</ns:ClientIpAddress>
           <ns:CultureName>nb-NO</ns:CultureName>
           <ns:PaymentFlow>Agreement</ns:PaymentFlow>
           <ns:PaymentOrderType>SingleSale</ns:PaymentOrderType>
        </ns:StartPaymentRequest>
      </soapenv:Body>
    </soapenv:Envelope>

    The output from this request is identical to other StartPaymentRequests in that it contains a redirect URL.

  2. Redirect the user to the payment provider and call UpdatePayment for the providers that needs it.

  3. Call CompletePayment to finish the payment.

  4. Finally get the CustomerNumber and various information from the CompletePayment result and call CreateCustomerPaymentAgreement

  5. Optionally associate the new agreement with a subscription

Once these steps are completed a new agreement will be associated with the Custome (and possibly the Subscription). The Agreement can be reused across subscriptions, or for balance and invoice payments.

Changing payment type for an existing subscription

In some cases a customer might wish to change his or hers payment type. It is possible to change the payment type of a subscription such that it uses a credit card agreement. In order to do this a customer and a subscription must exist.

Associating an agreement with a subscription is simply a matter of issuing a request to the ChangePaymentAgreement method.

Example Request for changing subscription payment agreement
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ChangeSubscriptionPaymentAgreementRequest>
         <ns:CustomerNumber>11225544</ns:CustomerNumber>
         <ns:PaymentAgreementId>42</ns:PaymentAgreementId>
         <ns:TitleCode>IS</ns:TitleCode>
      </ns:ChangeSubscriptionPaymentAgreementRequest>
   </soapenv:Body>
</soapenv:Envelope>

One Click purchases - Performing payments on agreements

In case you want to provide the customer with one-click purchases, you can do so by issuing a request to the method PerformAgreementPayment using the provider agreement reference retrieved from a CustomerPaymentAgreement. No interaction is required with the user, and so you don't need any redirects etc.

Example PerformAgreementPaymentRequest
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08">
  <soapenv:Header/>
  <soapenv:Body>
    <ns:PerformAgreementPaymentRequest>
        <ns:PaymentSetupCode>IS</ns:PaymentSetupCode>
        <ns:Price>40000</ns:Price>
        <ns:CurrencyCode>NOK</ns:CurrencyCode>
        <ns:TaxPercent>0</ns:TaxPercent>
        <ns:ProductDescription>An agreement payment.</ns:ProductDescription> 
        <ns:ExternalOrderId>Ext_42</ns:ExternalOrderId>
        <ns:PaymentOrderType>SingleSale</ns:PaymentOrderType>
        <ns:AgreementReference>245638732489135719834785</ns:AgreementReference>
    </ns:PerformAgreementPaymentRequest>
  </soapenv:Body>
</soapenv:Envelope>

Note that such a payment is not directly associated with any subscription or other InfoSystems modules so it is primarly intended for external web shops, or in cases where tracking the historic transaction is done in another system. Examples of such cases could be purchases in an online shop where each payment transaction is exported to the regular economy system.

Listing Customer Agreements

Using the method GetCustomerPaymentAgreements it is possible to get every agreement a customer has. Each agreement has some information that might be relevant to display to the user, such as the card type and mask.

Example request to list all agreements
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08">
    <soapenv:Header/>
  <soapenv:Body>
    <ns:GetPaymentAgreementsByCustomerRequest>
       <ns:CustomerNumber>12345678</ns:CustomerNumber>
    </ns:GetPaymentAgreementsByCustomerRequest>
</soapenv:Body>
</soapenv:Envelope>

To get an agreement for a given subscription, use the method GetPaymentAgreement.

Deleting an agreement

Since an agreement might be related to economic transactions, it is not really possible to delete an agreement, however it is possible to mark it as deleted. Thus it can be hidden from the end user, while still allowing the support personal to see historic agreements.

Please also note that an agreement has to be removed from any subscriptions it is used on before it can be deleted.

Note  Note

In case the provider supports it, the process of deleting an agreement will also delete it at the provider level. So it is not possible to restore an agreement.

Example request to delete an agreement
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:LockPaymentAgreementRequest>
         <ns:PaymentAgreementId>123456</ns:PaymentAgreementId>
      </ns:LockPaymentAgreementRequest>
   </soapenv:Body>
</soapenv:Envelope>
Caution note  Caution

Deleting/Locking an agreement won't automatically remove it from any subscriptions where it might be the payment type, so remember to remove it from the subscription before locking it.

Determining subscription agreement

It might be relevant to tell the user which agreement he or she is using to pay for a given subscription. In order to do this you can get the agreement reference using GetSubscriptionStatus (which will contain a PaymentAgreement_Id), after which you can get information about the selected agreement with GetCustomerPaymentAgreements (look to this section for details).

Removing an agreement from subscription

It is possible to remove the agreement from the subscription by using the method RemovePaymentAgreement. Given a title code and customer number it will disassociate the subscription from the payment agreement and revert the subscription to the default payment type for the title. The agreement will not be deleted and can later be associated again or used for other purchases.

XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://tech.infosoft.no/schemas/2012/08">
  <soapenv:Header/>
  <soapenv:Body>
    <ns:RemoveSubscriptionPaymentAgreementRequest>
      <ns:CustomerNumber>123456789</ns:CustomerNumber>
      <ns:TitleCode>IS</ns:TitleCode>
    </ns:RemoveSubscriptionPaymentAgreementRequest>
  </soapenv:Body>
</soapenv:Envelope>
See Also