If the app that uses ONE store's IAP V5 initiates payment or payment cancellation transactions through the ONE store payment system, ONE store passes a notification to the pre-configured Developer Center Server. The PNS (Payment Notification Service) can be used as a means to check the loss of payment information that may occur on mobile, and makes a push notification on payment and payment cancellation, respectively.
Since the payment notification may also be lost or the server that sends and receives notifications may fail, developers must not use the push notification they receive as a ground for providing in-app products.
The developers are required to provide the in-app products based on the payment completion response which is made for the payment request of the app. The payment notification is used for customer service purposes, including payment confirmation and withdrawal of items.
If you want to check the payment with a server-to-server, do not use PNS notification and we recommend using related server APIs like getPurchaseDetail or getPurchaseDetailByProduct.
ONE store can perform a payment test for verification and monitoring purposes, and the test results will be sent the same notification upon payment/cancellation. The payment test details are periodically cancelled by ONE store.
You can set up the developer's service server which receives the payment notification by selecting an in-app product on the 'Developer Center > Apps > My Applications' page and clicking the 'Payment Notification' button on the 'In-App' menu.
Payment Notification Message Format (ONE store → the developer's service server)
Using the codes below, you can verify that the signature is valid.
The public key in the source code means the License key provided by ONE store development center(Apps > In-App > Credentials).
For more information, refer to the 'Issue License Key' in the Preparatory Work page.
JAVA
importjava.security.PublicKey;importorg.apache.commons.codec.binary.Base64;importorg.codehaus.jackson.JsonNode;importorg.codehaus.jackson.map.ObjectMapper;importorg.codehaus.jackson.node.ObjectNode;publicclassSignatureVerifier {privatestaticfinalString SIGN_ALGORITHM ="SHA512withRSA";privateObjectMapper mapper =newObjectMapper();booleanverify(String rawMsg,PublicKey key) throwsException {// get the signature from the JSON messageJsonNode root =mapper.readTree(rawMsg);String signature =root.get("signature").getValueAsText(); ((ObjectNode)root).remove("signature");// check the validity of the signatureSignature sign =Signature.getInstance(SIGN_ALGORITHM);sign.initVerify(key);sign.update(root.toString().getBytes("UTF-8"));returnsign.verify(Base64.decodeBase64(signature)); }}
ONE store sends the fixed message: "SINGLE_PAYMENT_TRANSACTION"
purchaseId : String
Y
the purchase ID
developerPayload : String
N
the payment unique identifier that is provided by the developer
purchaseTimeMillis : Long
Y
the time when the payment is completed on the ONE store payment system(timestamp:Long)
purcahseState : enum
Y
COMPLETED : paid
CANCELED : cancelled
price : Number
Y
total payment amount
productName : String
N
It will be passed if the developer's service sets the customized in-app product name upon purchase request.
paymentTypeList : object[]
Y
payment information
paymentMethod : String
Y
payment method (the paymentMethod is defined below this table)
amount : Number
Y
payment amount
billingKey
N
the billingkey for the extension features
isTestMdn
N
ONE store test billing (true : test, false : normal billing/canceling case)
This parameter helps you to identify the ONE store test billing.
ONE store may purchase your In-App products for the review or test purpose and those purchases are canceled by ONE store.
In this case, you will receive PNS messages with this parameter set to 'true'.