PaymentAPI::StartPayment (open)
Start a payment
Syntax
LOADLIB "mod::wrd/lib/payments.whlib";
RECORD FUNCTION StartPayment(INTEGER entityid, MONEY amount, RECORD paymentdata)Parameters
INTEGER entityidEntity in which to record payment. This entity must be of the paymenttype. If 0, this is a precheck, not an actual payment attempt
MONEY amountAmount to request
RECORD paymentdataPayment metadata
BOOLEAN forceapprovedForce the transaction to be approved immediately, to allow us to 'shortcircuit' transaction flows
BOOLEAN isexternalRequest the external provider (for safety reasons setting paymentprovider=0 is not sufficient)
STRING languageCustomer language code
STRING paymentmethodtagMethod tag (combines provider + optional tag). Specify either this tag or both provider + optiontag
STRING paymentoptiontagOptional tag for payment provider (to select payment option)
INTEGER paymentproviderId of a payment provider
OBJECT wrdpersonentityWRD_PERSON entity describing the customer
Return value
RECORDPayment instruction
BOOLEAN completeIf true, the payment has already reached a final status
RECORD ARRAY errorsIf set, errors returned by the PSP which aborted this payment.
STRING errors.descriptionInternal description of the error
STRING errors.errorMessage to show to user, translated into the current language, if any
STRING errors.fieldAffected field, if known. Eg WRD_LASTNAME
RECORD submitinstructionIf set, submitinstruction to send to the client to complete payment
Description
Initiates the payment with the remote PSP. The payment must already be committed to the database and be in the 'pending' status. The PSP may do some final checks and stil return 'errors' - if so, the payment itself remains in pending status and no payment(reference) is recorded (but the next payment WILL have a different paymentreference)