digitaluapi

<back to all web services

PayFastWebHook

The following routes are available for this service:
POST/payfast/webhook/{PublicAccessGuid}
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PayFastWebHook:
    m_payment_id: Optional[str] = None
    pf_payment_id: Optional[str] = None
    payment_status: Optional[str] = None
    item_name: Optional[str] = None
    item_description: Optional[str] = None
    amount_gross: float = 0.0
    amount_fee: float = 0.0
    amount_net: float = 0.0
    custom_str1: Optional[str] = None
    custom_str2: Optional[str] = None
    custom_str3: Optional[str] = None
    custom_str4: Optional[str] = None
    custom_str5: Optional[str] = None
    custom_int1: int = 0
    custom_int2: int = 0
    custom_int3: int = 0
    custom_int4: int = 0
    custom_int5: int = 0
    name_first: Optional[str] = None
    name_last: Optional[str] = None
    email_address: Optional[str] = None
    merchant_id: Optional[str] = None
    signature: Optional[str] = None
    token: Optional[str] = None
    billing_date: datetime.datetime = datetime.datetime(1, 1, 1)
    public_access_guid: Optional[str] = None
    sandbox: bool = False

Python PayFastWebHook DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /payfast/webhook/{PublicAccessGuid} HTTP/1.1 
Host: duengageapi.uat.scadsoftware.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PayFastWebHook xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/digitaluapi.ServiceModel">
  <AmountFee>0</AmountFee>
  <AmountGross>0</AmountGross>
  <AmountNet>0</AmountNet>
  <BillingDate>0001-01-01T00:00:00</BillingDate>
  <CustomInt1>0</CustomInt1>
  <CustomInt2>0</CustomInt2>
  <CustomInt3>0</CustomInt3>
  <CustomInt4>0</CustomInt4>
  <CustomInt5>0</CustomInt5>
  <CustomStr1>String</CustomStr1>
  <CustomStr2>String</CustomStr2>
  <CustomStr3>String</CustomStr3>
  <CustomStr4>String</CustomStr4>
  <CustomStr5>String</CustomStr5>
  <EmailAddress>String</EmailAddress>
  <ItemDescription>String</ItemDescription>
  <ItemName>String</ItemName>
  <MPaymentId>String</MPaymentId>
  <MerchantId>String</MerchantId>
  <NameFirst>String</NameFirst>
  <NameLast>String</NameLast>
  <PaymentStatus>String</PaymentStatus>
  <PfPaymentId>String</PfPaymentId>
  <PublicAccessGuid>00000000-0000-0000-0000-000000000000</PublicAccessGuid>
  <Sandbox>false</Sandbox>
  <Signature>String</Signature>
  <Token>String</Token>
</PayFastWebHook>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />