Ok, IAP is now in. I got it down to these minimal routines:
Code:
//---------------------------------------------------------------------------
// In App Purchase
//---------------------------------------------------------------------------
procedure IAPSale(
// processing
aAPIKey : PChar;
aEvent : TIAPEvent;
// transaction
aTransactionAmount: PChar;
aTransactionDesc : PChar;
// credit card
aCardCVVData : PChar;
aCardExpMonth : Integer;
aCardExpYear : Integer;
aCardNumber : PChar;
// customer
aCustomerFirstName: PChar;
aCustomerLastName : PChar;
aCustomerAddress : PChar;
aCustomerCity : PChar;
aCustomerState : PChar;
aCustomerZip : PChar;
aCustomerCountry : Pchar;
aCustomerEmail : PChar;
aCustomerPhone : PChar
); stdcall; external LUNA_DLL;
function GetIAPResponseApproved: Boolean; stdcall; external LUNA_DLL;
function GetIAPResponseApprovalCode: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseAVSResult: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseCode: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseCVVResult: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseInvoiceNumber: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseText: PChar; stdcall; external LUNA_DLL;
function GetIAPResponseTransactionId: PChar; stdcall; external LUNA_DLL;
When you call IAPSale, the operation will be pushed into a background thread. When completed the aEvent routine will be called and you can then check the results with the GetIAPResponseXXX routines. If the transaction was approved GetIAPResponseApproved will be true and the transaction id (which is needed for refunds etc) will be returned. When testing, simply use your test API key you get from stripe. For a real purchase use the live key.
Since you also have database support, you can store your data on a remote database, on the local filesystem, encrypted, etc., as simple or elaborate as you wish.
Bookmarks