//
// Simple Bitcoin Payment Protocol messages
//
// Use fields 1000+ for extensions;
// to avoid conflicts, register extensions via pull-req at
// https://github.com/bitcoin/bips/blob/master/bip-0070/extensions.mediawiki
//

syntax = "proto3";
package libwallet;
option go_package = "/bip70";

// Generalized form of "send payment to this/these bitcoin addresses"
message Output {
        uint64 amount = 1; // amount is integer-number-of-satoshis
        bytes script = 2; // usually one of the standard Script forms
}
message PaymentDetails {
        string network = 1; // "main" or "test"
        repeated Output outputs = 2;        // Where payment should be sent
        uint64 time = 3;           // Timestamp; when payment request created
        uint64 expires = 4;        // Timestamp; when this request should be considered invalid
        string memo = 5;           // Human-readable description of request for the customer
        string payment_url = 6;    // URL to send Payment and get PaymentACK
        bytes merchant_data = 7;   // Arbitrary data to include in the Payment message
}
message PaymentRequest {
        uint32 payment_details_version = 1;
        string pki_type = 2;  // none / x509+sha256 / x509+sha1
        bytes pki_data = 3;                      // depends on pki_type
        bytes serialized_payment_details = 4;    // PaymentDetails
        bytes signature = 5;                     // pki-dependent signature
}
message X509Certificates {
        repeated bytes certificate = 1;    // DER-encoded X.509 certificate chain
}
message Payment {
        bytes merchant_data = 1;  // From PaymentDetails.merchant_data
        repeated bytes transactions = 2;   // Signed transactions that satisfy PaymentDetails.outputs
        repeated Output refund_to = 3;     // Where to send refunds, if a refund is necessary
        string memo = 4;          // Human-readable message for the merchant
}
message PaymentACK {
        Payment payment = 1;      // Payment message that triggered this ACK
        string memo = 2;          // human-readable message for customer
}
