Skip to content

Delivery and recovery

Documents @snap4id-sdk/app-embed 1.0.0 · @snap4id-sdk/embed-protocol 1.0.0 · protocol 1.0

A paid photo must never be lost, even if the app is killed between the payment and the delivery. The protocol is built for at-least-once delivery; your host keeps a small record per job and purchase and finishes interrupted work on the next start. The React Native component does this for you; a native host follows the same rules.

  • Delivery at least once. job.completed is sent once per page load of a paid job, and again whenever the job is reopened (/embed/{partnerId}/job/{jobId}). Store it idempotently by jobId. The component calls onCompleted until it resolves, and once more if the app dies between “resolved” and its own record.
  • Purchases finish only after the unlock, and only for the job they unlocked.
  • Recovery at every start. Unfinished store purchases are adopted and unlocked; paid jobs not yet delivered are reopened in a hidden WebView so the page sends job.completed again. The user does nothing.

File links are signed and live as long as the job: 30 days. Copy the files you keep. A link that expired while the job still exists is fixed by reopening the job, which sends fresh job.completed data. Your backend can also copy the files with the Partner API getJob.

Killed while… Next start
the store sheet was open an approved purchase is found among the store’s unfinished purchases and unlocked; a pending one stays pending (up to 24 h)
after paying, before the unlock the purchase is still unfinished: unlocked again (idempotent)
after the unlock, before delivery the job is reopened in the background and delivered
while storing the files delivery runs again for the same job

A second purchase for an already paid job is reported as duplicate_purchase before it is finished, so a kill can repeat the report but never lose it. Refund each reported transaction once.

Keep jobs and purchases per signed-in user (the component: one namespace per user).